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,30 @@
// Fixtura: Go. In Go un import nefolosit nu compileaza, deci importul e dovada de folosire.
package fixturi
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/hmac"
"crypto/md5"
"crypto/mlkem"
"crypto/rand"
"crypto/rsa"
"crypto/sha1"
"crypto/sha256" // EXPECT: SHA-256 | quantum-safe
"crypto/tls"
_ "crypto/sha512" // EXPECT: SHA-512 | quantum-safe
)
func Exemple(data []byte) {
k, _ := rsa.GenerateKey(rand.Reader, 3072) // EXPECT: RSA-3072 | quantum-vulnerable
e, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) // EXPECT: ECDSA-secp256r1 | quantum-vulnerable
s := md5.Sum(data) // EXPECT: MD5 | weak-now
m := hmac.New(sha1.New, data) // EXPECT: HMAC-SHA-1 | weak-now
dk, _ := mlkem.GenerateKey768() // EXPECT: ML-KEM-768 | quantum-safe
cfg := &tls.Config{
MinVersion: tls.VersionTLS12, // EXPECT: TLSv1.2 | quantum-vulnerable
CurvePreferences: []tls.CurveID{tls.X25519MLKEM768, tls.CurveP256}, // EXPECT: X25519MLKEM768 | quantum-safe ; ECDH-secp256r1 | quantum-vulnerable
}
f := sha256.New
_, _, _, _, _, _, _ = k, e, s, m, dk, cfg, f
}