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:
1 parent
7d814d1bb8
commit
0f081f0847
49 files changed
+4342
-33
No files matched your search
@@ -0,0 +1,36 @@
|
||||
// Fixtura: JCA, JSSE si Bouncy Castle. Fisierul nu se compileaza; e doar text pentru scaner.
|
||||
package fixturi;
|
||||
|
||||
import java.security.KeyPairGenerator;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.Signature;
|
||||
import java.security.spec.ECGenParameterSpec;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.KeyAgreement;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import org.bouncycastle.crypto.engines.RC4Engine; // EXPECT: RC4 | weak-now
|
||||
import org.bouncycastle.pqc.crypto.mlkem.MLKEMParameters;
|
||||
|
||||
public class Crypto {
|
||||
private static final String DIGEST = "SHA-256";
|
||||
|
||||
public void exemple(String algDinParametru) throws Exception {
|
||||
KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); // EXPECT: RSA-4096 | quantum-vulnerable
|
||||
kpg.initialize(4096);
|
||||
KeyPairGenerator ec = KeyPairGenerator.getInstance("EC"); // EXPECT: EC-secp256r1 | quantum-vulnerable
|
||||
ec.initialize(new ECGenParameterSpec("secp256r1"));
|
||||
Signature s1 = Signature.getInstance("SHA256withECDSA"); // EXPECT: ECDSA | quantum-vulnerable
|
||||
Signature s2 = Signature.getInstance("SHA1withRSA"); // EXPECT: RSA | weak-now
|
||||
Signature s3 = Signature.getInstance("ML-DSA-65"); // EXPECT: ML-DSA-65 | quantum-safe
|
||||
Cipher c1 = Cipher.getInstance("AES"); // EXPECT: AES-ECB | weak-now
|
||||
Cipher c2 = Cipher.getInstance("AES/GCM/NoPadding"); // EXPECT: AES-GCM | quantum-safe
|
||||
Cipher c3 = Cipher.getInstance("RSA/ECB/OAEPWithSHA-256AndMGF1Padding"); // EXPECT: RSA | quantum-vulnerable
|
||||
Cipher c4 = Cipher.getInstance("DESede/CBC/PKCS5Padding"); // EXPECT: 3DES-CBC | weak-now
|
||||
KeyAgreement ka = KeyAgreement.getInstance("X25519"); // EXPECT: X25519 | quantum-vulnerable
|
||||
MessageDigest md = MessageDigest.getInstance("MD5"); // EXPECT: MD5 | weak-now
|
||||
MessageDigest md2 = MessageDigest.getInstance(DIGEST); // EXPECT: SHA-256 | quantum-safe
|
||||
MessageDigest md3 = MessageDigest.getInstance(algDinParametru); // EXPECT: MessageDigest.getInstance | unknown
|
||||
SSLContext tls = SSLContext.getInstance("TLSv1.1"); // EXPECT: TLSv1.1 | weak-now
|
||||
Object p = MLKEMParameters.ml_kem_768; // EXPECT: ML-KEM-768 | quantum-safe
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user