Add crypto-inventory: a cryptographic inventory of source code as a CycloneDX 1.6 CBOM, with linear cost on hostile input; PKI DER messages in English

This commit is contained in:
Aere Network committed 2026-09-29 17:42:36 +03:00
1 parent 7d814d1bb8
commit 0f081f0847
49 files changed
+4342 -33

No files matched your search

@@ -0,0 +1,15 @@
// Fixtura: WebCrypto (browser sau globalThis.crypto in Node).
const subtle = globalThis.crypto.subtle;
export async function webcrypto(data) {
const rsa = await subtle.generateKey(
{ name: 'RSA-OAEP', modulusLength: 3072, publicExponent: new Uint8Array([1, 0, 1]), hash: 'SHA-256' }, // EXPECT: RSA-3072 | quantum-vulnerable
true, ['encrypt', 'decrypt']);
const ec = await subtle.generateKey({ name: 'ECDSA', namedCurve: 'P-384' }, true, ['sign', 'verify']); // EXPECT: ECDSA-secp384r1 | quantum-vulnerable
const ed = await subtle.generateKey('Ed25519', true, ['sign', 'verify']); // EXPECT: Ed25519 | quantum-vulnerable
const x = await subtle.generateKey({ name: 'X25519' }, true, ['deriveBits']); // EXPECT: X25519 | quantum-vulnerable
const aes = await subtle.generateKey({ name: 'AES-GCM', length: 256 }, true, ['encrypt']); // EXPECT: AES-256-GCM | quantum-safe
const d1 = await subtle.digest('SHA-1', data); // EXPECT: SHA-1 | weak-now
const d2 = await subtle.digest({ name: 'SHA-384' }, data); // EXPECT: SHA-384 | quantum-safe
return [rsa, ec, ed, x, aes, d1, d2];
}