mirror of
https://github.com/aquasecurity/trivy.git
synced 2026-12-02 01:40:33 +00:00
feat(crypto): read certificates from JKS keystores (#11400)
This commit is contained in:
1 parent
e2c05f7ae6
commit
559ee38654
12 files changed
+1105
-21
No files matched your search
@@ -17,11 +17,11 @@ Trivy rejects `--scanners crypto` with other report formats.
|
||||
|
||||
Files are selected by extension: `.pem`, `.der`, `.crt`, `.cer`, `.key`. The encoding comes from the content, since these extensions carry both PEM and DER.
|
||||
|
||||
Keystores are selected by the `.p12`, `.pfx`, `.jks` and `.keystore` extensions and by the exact file name `cacerts` of the Java trust store. A `.jks` file is read when it holds PKCS#12, which keytool writes by default since JDK 9.
|
||||
Keystores are selected by the `.p12`, `.pfx`, `.jks` and `.keystore` extensions and by the exact file name `cacerts` of the Java trust store. The keystore format comes from the content, because keytool writes PKCS#12 by default since JDK 9, also to `.jks` files.
|
||||
|
||||
| Material | Formats |
|
||||
| --- | --- |
|
||||
| X.509 certificates | PEM, DER, PKCS#12 keystores |
|
||||
| X.509 certificates | PEM, DER, PKCS#12 and JKS keystores |
|
||||
| Private keys | PKCS#1, PKCS#8, SEC1, in PEM or DER |
|
||||
| Public keys | PKIX, in PEM or DER |
|
||||
| Encrypted private keys | PKCS#8 in PEM or DER, legacy encrypted PEM |
|
||||
@@ -217,7 +217,7 @@ The scanner is available for `trivy image` only.
|
||||
|
||||
Trivy rejects `--scanners crypto` together with [`--sbom-sources`](../target/container_image.md#discover-sbom-referencing-the-container-image), because a remote SBOM found for the image replaces the analysis of its layers.
|
||||
|
||||
A file without one of the extensions above is not read, so a key in a file named `tls-key` or inside a config file is missed. You can point the scanner at such a file with [`--file-patterns`](../configuration/skipping.md#customizing-file-handling), as long as it holds PEM or DER material or a PKCS#12 keystore:
|
||||
A file without one of the extensions above is not read, so a key in a file named `tls-key` or inside a config file is missed. You can point the scanner at such a file with [`--file-patterns`](../configuration/skipping.md#customizing-file-handling), as long as it holds PEM or DER material or a PKCS#12 or JKS keystore:
|
||||
|
||||
```shell
|
||||
$ trivy image --scanners crypto --format cyclonedx --file-patterns "crypto:etc/app/tls-key" myimage:1.0.0
|
||||
@@ -225,10 +225,10 @@ $ trivy image --scanners crypto --format cyclonedx --file-patterns "crypto:etc/a
|
||||
|
||||
Files larger than 10 MB are skipped, because a file of that size with one of these extensions is almost never cryptographic material.
|
||||
|
||||
Some objects are recognized and skipped. Certificate signing requests, CRLs and PKCS#7 bundles are not part of the inventory. OpenSSH keys, JKS and JCEKS keystores and OpenPGP keyrings are not covered yet. A certificate or key that uses an EC key with explicit curve parameters instead of a named curve cannot be parsed and is skipped as well. Private keys of X25519, X448 and Ed448 are skipped, although their public keys are reported.
|
||||
Some objects are recognized and skipped. Certificate signing requests, CRLs and PKCS#7 bundles are not part of the inventory. OpenSSH keys, JCEKS keystores and OpenPGP keyrings are not covered yet. A certificate or key that uses an EC key with explicit curve parameters instead of a named curve cannot be parsed and is skipped as well. Private keys of X25519, X448 and Ed448 are skipped, although their public keys are reported.
|
||||
|
||||
From certificates and keys on the curve P-192, only the `EC-P-192` algorithm is extracted.
|
||||
|
||||
Trivy does not decrypt PKCS#12 keystores and does not report their private keys, so it reads only the certificates stored without encryption. keytool, OpenSSL and .NET encrypt the certificates unless encryption is turned off explicitly, such as with `-certpbe NONE` in OpenSSL or `-J-Dkeystore.pkcs12.certProtectionAlgorithm=NONE` in keytool. OpenSSL encrypts them even with an empty password. The `cacerts` trust store that ships with JDK 18 and later has no password and is read in full.
|
||||
Trivy does not decrypt PKCS#12 keystores and does not report their private keys, so it reads only the certificates stored without encryption. keytool, OpenSSL and .NET encrypt the certificates unless encryption is turned off explicitly, such as with `-certpbe NONE` in OpenSSL or `-J-Dkeystore.pkcs12.certProtectionAlgorithm=NONE` in keytool. OpenSSL encrypts them even with an empty password. The `cacerts` trust store that ships with JDK 18 and later has no password and is read in full. A PKCS#12 keystore protected by a public-key signature instead of a password-based MAC is not read. Parts of a keystore encoded in BER rather than DER are skipped. Trivy reads at most 10000 bags from one keystore.
|
||||
|
||||
The `cacerts` of JDK 17 and earlier is a JKS keystore and is skipped. A PKCS#12 keystore protected by a public-key signature instead of a password-based MAC is not read. Parts of a keystore encoded in BER rather than DER are skipped. Trivy reads at most 10000 bags from one keystore.
|
||||
A JKS keystore stores its certificates without encryption, so Trivy reads all of them, including the `cacerts` trust store of JDK 17 and earlier. Trivy does not decrypt JKS keystores and does not report private keys, but it reads the certificate chains associated with private key entries. Trivy reads at most 10000 certificates from one JKS keystore.
|
||||
+140
@@ -151,9 +151,17 @@
|
||||
"location": "etc/ssl/private/ec.key",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
},
|
||||
{
|
||||
"location": "opt/app/truststore.keystore",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
},
|
||||
{
|
||||
"location": "opt/java/jdk-21/lib/security/cacerts",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
},
|
||||
{
|
||||
"location": "opt/java/jdk-8/jre/lib/security/cacerts",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -200,9 +208,17 @@
|
||||
"location": "etc/ssl/certs/ec.der",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
},
|
||||
{
|
||||
"location": "opt/app/truststore.keystore",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
},
|
||||
{
|
||||
"location": "opt/java/jdk-21/lib/security/cacerts",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
},
|
||||
{
|
||||
"location": "opt/java/jdk-8/jre/lib/security/cacerts",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -254,6 +270,10 @@
|
||||
"location": "etc/ssl/certs/rsa.pem",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
},
|
||||
{
|
||||
"location": "opt/app/app.jks",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
},
|
||||
{
|
||||
"location": "opt/app/app.pfx",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
@@ -269,6 +289,10 @@
|
||||
{
|
||||
"location": "opt/java/jdk-21/lib/security/cacerts",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
},
|
||||
{
|
||||
"location": "opt/java/jdk-8/jre/lib/security/cacerts",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -347,6 +371,10 @@
|
||||
"location": "etc/ssl/public/rsa.pem",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
},
|
||||
{
|
||||
"location": "opt/app/app.jks",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
},
|
||||
{
|
||||
"location": "opt/app/app.pfx",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
@@ -362,6 +390,10 @@
|
||||
{
|
||||
"location": "opt/java/jdk-21/lib/security/cacerts",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
},
|
||||
{
|
||||
"location": "opt/java/jdk-8/jre/lib/security/cacerts",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -566,6 +598,44 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"bom-ref": "crypto:certificate:sha256:2a2da943a7c4eb44ec01c22f3052ddd71104deddc03c8d54afed9469262e24db",
|
||||
"type": "cryptographic-asset",
|
||||
"name": "jks.trivy.test",
|
||||
"evidence": {
|
||||
"occurrences": [
|
||||
{
|
||||
"location": "opt/app/app.jks",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
]
|
||||
},
|
||||
"cryptoProperties": {
|
||||
"assetType": "certificate",
|
||||
"certificateProperties": {
|
||||
"serialNumber": "718db6146e19bf5c",
|
||||
"subjectName": "CN=jks.trivy.test",
|
||||
"issuerName": "CN=jks.trivy.test",
|
||||
"notValidBefore": "2024-01-01T00:00:00+00:00",
|
||||
"notValidAfter": "2034-01-01T00:00:00+00:00",
|
||||
"certificateFormat": "X.509",
|
||||
"fingerprint": {
|
||||
"alg": "SHA-256",
|
||||
"content": "2a2da943a7c4eb44ec01c22f3052ddd71104deddc03c8d54afed9469262e24db"
|
||||
},
|
||||
"relatedCryptographicAssets": [
|
||||
{
|
||||
"type": "algorithm",
|
||||
"ref": "crypto:algorithm:oid:1.2.840.113549.1.1.11"
|
||||
},
|
||||
{
|
||||
"type": "publicKey",
|
||||
"ref": "crypto:key:public:spki-sha256:7013248ea25a7a66f08c9eb279f0e47523e3c5b470d16f520423f680bc802f14"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"bom-ref": "crypto:certificate:sha256:3e6838cf96d6014bc45f8821a5512525e0879bd4ccbe0ff1550e6cbbed7bae9b",
|
||||
"type": "cryptographic-asset",
|
||||
@@ -664,6 +734,10 @@
|
||||
"location": "etc/ssl/certs/rsa.pem",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
},
|
||||
{
|
||||
"location": "opt/app/app.jks",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
},
|
||||
{
|
||||
"location": "opt/app/app.pfx",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
@@ -675,6 +749,10 @@
|
||||
{
|
||||
"location": "opt/app/truststore.p12",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
},
|
||||
{
|
||||
"location": "opt/java/jdk-8/jre/lib/security/cacerts",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -814,9 +892,17 @@
|
||||
"location": "etc/ssl/certs/ec.der",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
},
|
||||
{
|
||||
"location": "opt/app/truststore.keystore",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
},
|
||||
{
|
||||
"location": "opt/java/jdk-21/lib/security/cacerts",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
},
|
||||
{
|
||||
"location": "opt/java/jdk-8/jre/lib/security/cacerts",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1472,9 +1558,17 @@
|
||||
"location": "etc/ssl/certs/ec.der",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
},
|
||||
{
|
||||
"location": "opt/app/truststore.keystore",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
},
|
||||
{
|
||||
"location": "opt/java/jdk-21/lib/security/cacerts",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
},
|
||||
{
|
||||
"location": "opt/java/jdk-8/jre/lib/security/cacerts",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1590,6 +1684,36 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"bom-ref": "crypto:key:public:spki-sha256:7013248ea25a7a66f08c9eb279f0e47523e3c5b470d16f520423f680bc802f14",
|
||||
"type": "cryptographic-asset",
|
||||
"name": "RSA-2048 public key",
|
||||
"evidence": {
|
||||
"occurrences": [
|
||||
{
|
||||
"location": "opt/app/app.jks",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
]
|
||||
},
|
||||
"cryptoProperties": {
|
||||
"assetType": "related-crypto-material",
|
||||
"relatedCryptoMaterialProperties": {
|
||||
"type": "public-key",
|
||||
"size": 2048,
|
||||
"fingerprint": {
|
||||
"alg": "SHA-256",
|
||||
"content": "7013248ea25a7a66f08c9eb279f0e47523e3c5b470d16f520423f680bc802f14"
|
||||
},
|
||||
"relatedCryptographicAssets": [
|
||||
{
|
||||
"type": "algorithm",
|
||||
"ref": "crypto:algorithm:oid:1.2.840.113549.1.1.1:key-size%3D2048"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"bom-ref": "crypto:key:public:spki-sha256:7bdf71a24b2aca83dc03af5aa62adfee0a092562e8af13684a56068f94d32cb2",
|
||||
"type": "cryptographic-asset",
|
||||
@@ -1758,6 +1882,10 @@
|
||||
"location": "etc/ssl/public/rsa.pem",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
},
|
||||
{
|
||||
"location": "opt/app/app.jks",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
},
|
||||
{
|
||||
"location": "opt/app/app.pfx",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
@@ -1769,6 +1897,10 @@
|
||||
{
|
||||
"location": "opt/app/truststore.p12",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
},
|
||||
{
|
||||
"location": "opt/java/jdk-8/jre/lib/security/cacerts",
|
||||
"additionalContext": "aquasecurity:trivy:LayerDiffID=sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1864,6 +1996,10 @@
|
||||
"ref": "crypto:certificate:sha256:1e2719773372f963a1b30b0a250c670c86f03c29dc4722b33df9892ef57b8ff1",
|
||||
"dependsOn": []
|
||||
},
|
||||
{
|
||||
"ref": "crypto:certificate:sha256:2a2da943a7c4eb44ec01c22f3052ddd71104deddc03c8d54afed9469262e24db",
|
||||
"dependsOn": []
|
||||
},
|
||||
{
|
||||
"ref": "crypto:certificate:sha256:3e6838cf96d6014bc45f8821a5512525e0879bd4ccbe0ff1550e6cbbed7bae9b",
|
||||
"dependsOn": []
|
||||
@@ -1972,6 +2108,10 @@
|
||||
"ref": "crypto:key:public:spki-sha256:4d8fc17639e87c23ca5197dd407b35172e6565910374bccc9a3a22276cfc99a0",
|
||||
"dependsOn": []
|
||||
},
|
||||
{
|
||||
"ref": "crypto:key:public:spki-sha256:7013248ea25a7a66f08c9eb279f0e47523e3c5b470d16f520423f680bc802f14",
|
||||
"dependsOn": []
|
||||
},
|
||||
{
|
||||
"ref": "crypto:key:public:spki-sha256:7bdf71a24b2aca83dc03af5aa62adfee0a092562e8af13684a56068f94d32cb2",
|
||||
"dependsOn": []
|
||||
|
||||
+494
@@ -227,6 +227,26 @@
|
||||
"DiffID": "sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "b671b647ee1a37eb",
|
||||
"Kind": "algorithm",
|
||||
"Identity": {
|
||||
"Method": "oid",
|
||||
"Value": "1.2.840.10045.2.1",
|
||||
"Parameters": "curve=P-256"
|
||||
},
|
||||
"Name": "EC-P-256",
|
||||
"Algorithm": {
|
||||
"Primitive": "unknown",
|
||||
"ClassicalSecurityLevel": 128,
|
||||
"NISTQuantumSecurityLevel": 0
|
||||
},
|
||||
"FilePath": "opt/app/truststore.keystore",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "3e5b275937359f8c",
|
||||
"Kind": "algorithm",
|
||||
@@ -247,6 +267,26 @@
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "e1eccaf15adef515",
|
||||
"Kind": "algorithm",
|
||||
"Identity": {
|
||||
"Method": "oid",
|
||||
"Value": "1.2.840.10045.2.1",
|
||||
"Parameters": "curve=P-256"
|
||||
},
|
||||
"Name": "EC-P-256",
|
||||
"Algorithm": {
|
||||
"Primitive": "unknown",
|
||||
"ClassicalSecurityLevel": 128,
|
||||
"NISTQuantumSecurityLevel": 0
|
||||
},
|
||||
"FilePath": "opt/java/jdk-8/jre/lib/security/cacerts",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "5d9c4714f015f612",
|
||||
"Kind": "algorithm",
|
||||
@@ -285,6 +325,25 @@
|
||||
"DiffID": "sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "f2220b7a794b7484",
|
||||
"Kind": "algorithm",
|
||||
"Identity": {
|
||||
"Method": "oid",
|
||||
"Value": "1.2.840.10045.4.3.2"
|
||||
},
|
||||
"Name": "ECDSA-SHA-256",
|
||||
"Algorithm": {
|
||||
"Family": "ECDSA",
|
||||
"Primitive": "signature",
|
||||
"NISTQuantumSecurityLevel": 0
|
||||
},
|
||||
"FilePath": "opt/app/truststore.keystore",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "33cbc5298d1edb9f",
|
||||
"Kind": "algorithm",
|
||||
@@ -304,6 +363,25 @@
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "1ef29bfd1a07d01a",
|
||||
"Kind": "algorithm",
|
||||
"Identity": {
|
||||
"Method": "oid",
|
||||
"Value": "1.2.840.10045.4.3.2"
|
||||
},
|
||||
"Name": "ECDSA-SHA-256",
|
||||
"Algorithm": {
|
||||
"Family": "ECDSA",
|
||||
"Primitive": "signature",
|
||||
"NISTQuantumSecurityLevel": 0
|
||||
},
|
||||
"FilePath": "opt/java/jdk-8/jre/lib/security/cacerts",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "31a2a39feabc61a5",
|
||||
"Kind": "algorithm",
|
||||
@@ -504,6 +582,26 @@
|
||||
"DiffID": "sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "bd236caed66df15f",
|
||||
"Kind": "algorithm",
|
||||
"Identity": {
|
||||
"Method": "oid",
|
||||
"Value": "1.2.840.113549.1.1.1",
|
||||
"Parameters": "key-size=2048"
|
||||
},
|
||||
"Name": "RSA-2048",
|
||||
"Algorithm": {
|
||||
"Primitive": "unknown",
|
||||
"ClassicalSecurityLevel": 112,
|
||||
"NISTQuantumSecurityLevel": 0
|
||||
},
|
||||
"FilePath": "opt/app/app.jks",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "eeca7531e0ef28da",
|
||||
"Kind": "algorithm",
|
||||
@@ -584,6 +682,26 @@
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "f4f2e85d82fb8b36",
|
||||
"Kind": "algorithm",
|
||||
"Identity": {
|
||||
"Method": "oid",
|
||||
"Value": "1.2.840.113549.1.1.1",
|
||||
"Parameters": "key-size=2048"
|
||||
},
|
||||
"Name": "RSA-2048",
|
||||
"Algorithm": {
|
||||
"Primitive": "unknown",
|
||||
"ClassicalSecurityLevel": 112,
|
||||
"NISTQuantumSecurityLevel": 0
|
||||
},
|
||||
"FilePath": "opt/java/jdk-8/jre/lib/security/cacerts",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "438bf672534103b8",
|
||||
"Kind": "algorithm",
|
||||
@@ -656,6 +774,25 @@
|
||||
"DiffID": "sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "46f73011855c664f",
|
||||
"Kind": "algorithm",
|
||||
"Identity": {
|
||||
"Method": "oid",
|
||||
"Value": "1.2.840.113549.1.1.11"
|
||||
},
|
||||
"Name": "RSA-PKCS1-1.5-SHA-256",
|
||||
"Algorithm": {
|
||||
"Family": "RSASSA-PKCS1",
|
||||
"Primitive": "signature",
|
||||
"NISTQuantumSecurityLevel": 0
|
||||
},
|
||||
"FilePath": "opt/app/app.jks",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "f941ebafb19fd07a",
|
||||
"Kind": "algorithm",
|
||||
@@ -732,6 +869,25 @@
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "40e75d4858c00eb6",
|
||||
"Kind": "algorithm",
|
||||
"Identity": {
|
||||
"Method": "oid",
|
||||
"Value": "1.2.840.113549.1.1.11"
|
||||
},
|
||||
"Name": "RSA-PKCS1-1.5-SHA-256",
|
||||
"Algorithm": {
|
||||
"Family": "RSASSA-PKCS1",
|
||||
"Primitive": "signature",
|
||||
"NISTQuantumSecurityLevel": 0
|
||||
},
|
||||
"FilePath": "opt/java/jdk-8/jre/lib/security/cacerts",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "b1939b6db552f2f4",
|
||||
"Kind": "algorithm",
|
||||
@@ -955,6 +1111,40 @@
|
||||
"DiffID": "sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "921083fd36ea66e9",
|
||||
"Kind": "certificate",
|
||||
"Identity": {
|
||||
"Method": "sha256",
|
||||
"Value": "2a2da943a7c4eb44ec01c22f3052ddd71104deddc03c8d54afed9469262e24db"
|
||||
},
|
||||
"Name": "jks.trivy.test",
|
||||
"Certificate": {
|
||||
"Subject": "CN=jks.trivy.test",
|
||||
"Issuer": "CN=jks.trivy.test",
|
||||
"SerialNumber": "718db6146e19bf5c",
|
||||
"NotBefore": "2024-01-01T00:00:00Z",
|
||||
"NotAfter": "2034-01-01T00:00:00Z",
|
||||
"Format": "X.509"
|
||||
},
|
||||
"Relationships": [
|
||||
{
|
||||
"Type": "signed_with",
|
||||
"RelatedAsset": "algorithm:oid:1.2.840.113549.1.1.11"
|
||||
},
|
||||
{
|
||||
"Type": "contains",
|
||||
"RelatedAsset": "key:public:spki-sha256:7013248ea25a7a66f08c9eb279f0e47523e3c5b470d16f520423f680bc802f14"
|
||||
}
|
||||
],
|
||||
"FilePath": "opt/app/app.jks",
|
||||
"Encoding": "DER",
|
||||
"Keystore": "JKS",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "7dd1bdf72af1418d",
|
||||
"Kind": "certificate",
|
||||
@@ -1079,6 +1269,61 @@
|
||||
"DiffID": "sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "2a3ab09731676b45",
|
||||
"Kind": "certificate",
|
||||
"Identity": {
|
||||
"Method": "sha256",
|
||||
"Value": "49511b8deae44f5795de1c53402c519ed125a31a558ae318ffa81ea847840bfc"
|
||||
},
|
||||
"Name": "rsa.trivy.test",
|
||||
"Certificate": {
|
||||
"Subject": "CN=rsa.trivy.test",
|
||||
"Issuer": "CN=rsa.trivy.test",
|
||||
"SerialNumber": "1",
|
||||
"NotBefore": "2024-01-01T00:00:00Z",
|
||||
"NotAfter": "2034-01-01T00:00:00Z",
|
||||
"Format": "X.509",
|
||||
"KeyUsage": [
|
||||
"digitalSignature",
|
||||
"keyEncipherment"
|
||||
],
|
||||
"ExtendedKeyUsage": [
|
||||
"serverAuth",
|
||||
"clientAuth"
|
||||
],
|
||||
"DNSNames": [
|
||||
"rsa.trivy.test"
|
||||
],
|
||||
"EmailAddresses": [
|
||||
"crypto@trivy.test"
|
||||
],
|
||||
"IPAddresses": [
|
||||
"127.0.0.1"
|
||||
],
|
||||
"URIs": [
|
||||
"https://trivy.test/rsa"
|
||||
],
|
||||
"BasicConstraintsValid": true
|
||||
},
|
||||
"Relationships": [
|
||||
{
|
||||
"Type": "signed_with",
|
||||
"RelatedAsset": "algorithm:oid:1.2.840.113549.1.1.11"
|
||||
},
|
||||
{
|
||||
"Type": "contains",
|
||||
"RelatedAsset": "key:public:spki-sha256:f7899050cfc485328d86af4668f4626a21f5ebe243a7db920d40a51a2e6dfe37"
|
||||
}
|
||||
],
|
||||
"FilePath": "opt/app/app.jks",
|
||||
"Encoding": "DER",
|
||||
"Keystore": "JKS",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "4441a311b861dc8",
|
||||
"Kind": "certificate",
|
||||
@@ -1243,6 +1488,61 @@
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "b4a2244f2b4455f8",
|
||||
"Kind": "certificate",
|
||||
"Identity": {
|
||||
"Method": "sha256",
|
||||
"Value": "49511b8deae44f5795de1c53402c519ed125a31a558ae318ffa81ea847840bfc"
|
||||
},
|
||||
"Name": "rsa.trivy.test",
|
||||
"Certificate": {
|
||||
"Subject": "CN=rsa.trivy.test",
|
||||
"Issuer": "CN=rsa.trivy.test",
|
||||
"SerialNumber": "1",
|
||||
"NotBefore": "2024-01-01T00:00:00Z",
|
||||
"NotAfter": "2034-01-01T00:00:00Z",
|
||||
"Format": "X.509",
|
||||
"KeyUsage": [
|
||||
"digitalSignature",
|
||||
"keyEncipherment"
|
||||
],
|
||||
"ExtendedKeyUsage": [
|
||||
"serverAuth",
|
||||
"clientAuth"
|
||||
],
|
||||
"DNSNames": [
|
||||
"rsa.trivy.test"
|
||||
],
|
||||
"EmailAddresses": [
|
||||
"crypto@trivy.test"
|
||||
],
|
||||
"IPAddresses": [
|
||||
"127.0.0.1"
|
||||
],
|
||||
"URIs": [
|
||||
"https://trivy.test/rsa"
|
||||
],
|
||||
"BasicConstraintsValid": true
|
||||
},
|
||||
"Relationships": [
|
||||
{
|
||||
"Type": "signed_with",
|
||||
"RelatedAsset": "algorithm:oid:1.2.840.113549.1.1.11"
|
||||
},
|
||||
{
|
||||
"Type": "contains",
|
||||
"RelatedAsset": "key:public:spki-sha256:f7899050cfc485328d86af4668f4626a21f5ebe243a7db920d40a51a2e6dfe37"
|
||||
}
|
||||
],
|
||||
"FilePath": "opt/java/jdk-8/jre/lib/security/cacerts",
|
||||
"Encoding": "DER",
|
||||
"Keystore": "JKS",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "e425eadf9abda23",
|
||||
"Kind": "certificate",
|
||||
@@ -1346,6 +1646,42 @@
|
||||
"DiffID": "sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "7101ef9443b76c6c",
|
||||
"Kind": "certificate",
|
||||
"Identity": {
|
||||
"Method": "sha256",
|
||||
"Value": "7690267fff6e6c1b682638407af8efee498a26ed7135735a94b13343bfa7a77e"
|
||||
},
|
||||
"Name": "ec.trivy.test",
|
||||
"Certificate": {
|
||||
"Subject": "CN=ec.trivy.test",
|
||||
"Issuer": "CN=ec.trivy.test",
|
||||
"SerialNumber": "2",
|
||||
"NotBefore": "2024-01-01T00:00:00Z",
|
||||
"NotAfter": "2034-01-01T00:00:00Z",
|
||||
"Format": "X.509",
|
||||
"BasicConstraintsValid": true,
|
||||
"IsCA": true
|
||||
},
|
||||
"Relationships": [
|
||||
{
|
||||
"Type": "signed_with",
|
||||
"RelatedAsset": "algorithm:oid:1.2.840.10045.4.3.2"
|
||||
},
|
||||
{
|
||||
"Type": "contains",
|
||||
"RelatedAsset": "key:public:spki-sha256:2ff85872be647e7dfd68fdc8e04e678405b28e572b73c99f949650c4aed07354"
|
||||
}
|
||||
],
|
||||
"FilePath": "opt/app/truststore.keystore",
|
||||
"Encoding": "DER",
|
||||
"Keystore": "JKS",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "644f6df1a65e9a7f",
|
||||
"Kind": "certificate",
|
||||
@@ -1382,6 +1718,42 @@
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "e780b1a5d90e91aa",
|
||||
"Kind": "certificate",
|
||||
"Identity": {
|
||||
"Method": "sha256",
|
||||
"Value": "7690267fff6e6c1b682638407af8efee498a26ed7135735a94b13343bfa7a77e"
|
||||
},
|
||||
"Name": "ec.trivy.test",
|
||||
"Certificate": {
|
||||
"Subject": "CN=ec.trivy.test",
|
||||
"Issuer": "CN=ec.trivy.test",
|
||||
"SerialNumber": "2",
|
||||
"NotBefore": "2024-01-01T00:00:00Z",
|
||||
"NotAfter": "2034-01-01T00:00:00Z",
|
||||
"Format": "X.509",
|
||||
"BasicConstraintsValid": true,
|
||||
"IsCA": true
|
||||
},
|
||||
"Relationships": [
|
||||
{
|
||||
"Type": "signed_with",
|
||||
"RelatedAsset": "algorithm:oid:1.2.840.10045.4.3.2"
|
||||
},
|
||||
{
|
||||
"Type": "contains",
|
||||
"RelatedAsset": "key:public:spki-sha256:2ff85872be647e7dfd68fdc8e04e678405b28e572b73c99f949650c4aed07354"
|
||||
}
|
||||
],
|
||||
"FilePath": "opt/java/jdk-8/jre/lib/security/cacerts",
|
||||
"Encoding": "DER",
|
||||
"Keystore": "JKS",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "3d53cb300ec2b9da",
|
||||
"Kind": "certificate",
|
||||
@@ -2057,6 +2429,31 @@
|
||||
"DiffID": "sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "a85bd2549aa8b09d",
|
||||
"Kind": "key",
|
||||
"KeyType": "public",
|
||||
"Identity": {
|
||||
"Method": "spki-sha256",
|
||||
"Value": "2ff85872be647e7dfd68fdc8e04e678405b28e572b73c99f949650c4aed07354"
|
||||
},
|
||||
"Name": "EC-P-256 public key",
|
||||
"Key": {
|
||||
"Size": 256,
|
||||
"Curve": "P-256"
|
||||
},
|
||||
"Relationships": [
|
||||
{
|
||||
"Type": "used_with",
|
||||
"RelatedAsset": "algorithm:oid:1.2.840.10045.2.1:curve%3DP-256"
|
||||
}
|
||||
],
|
||||
"FilePath": "opt/app/truststore.keystore",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "ce452540bb40b20e",
|
||||
"Kind": "key",
|
||||
@@ -2082,6 +2479,31 @@
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "4a0cca8932b9f393",
|
||||
"Kind": "key",
|
||||
"KeyType": "public",
|
||||
"Identity": {
|
||||
"Method": "spki-sha256",
|
||||
"Value": "2ff85872be647e7dfd68fdc8e04e678405b28e572b73c99f949650c4aed07354"
|
||||
},
|
||||
"Name": "EC-P-256 public key",
|
||||
"Key": {
|
||||
"Size": 256,
|
||||
"Curve": "P-256"
|
||||
},
|
||||
"Relationships": [
|
||||
{
|
||||
"Type": "used_with",
|
||||
"RelatedAsset": "algorithm:oid:1.2.840.10045.2.1:curve%3DP-256"
|
||||
}
|
||||
],
|
||||
"FilePath": "opt/java/jdk-8/jre/lib/security/cacerts",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "c0325b04a4b84384",
|
||||
"Kind": "key",
|
||||
@@ -2179,6 +2601,30 @@
|
||||
"DiffID": "sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "795e117a4530477b",
|
||||
"Kind": "key",
|
||||
"KeyType": "public",
|
||||
"Identity": {
|
||||
"Method": "spki-sha256",
|
||||
"Value": "7013248ea25a7a66f08c9eb279f0e47523e3c5b470d16f520423f680bc802f14"
|
||||
},
|
||||
"Name": "RSA-2048 public key",
|
||||
"Key": {
|
||||
"Size": 2048
|
||||
},
|
||||
"Relationships": [
|
||||
{
|
||||
"Type": "used_with",
|
||||
"RelatedAsset": "algorithm:oid:1.2.840.113549.1.1.1:key-size%3D2048"
|
||||
}
|
||||
],
|
||||
"FilePath": "opt/app/app.jks",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "c7b374721b4184ad",
|
||||
"Kind": "key",
|
||||
@@ -2375,6 +2821,30 @@
|
||||
"DiffID": "sha256:8be4950119af3d5904781c15c5ba7e01951daf465a3567077b031a9c58d5275f"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "da5b6f2bae477d94",
|
||||
"Kind": "key",
|
||||
"KeyType": "public",
|
||||
"Identity": {
|
||||
"Method": "spki-sha256",
|
||||
"Value": "f7899050cfc485328d86af4668f4626a21f5ebe243a7db920d40a51a2e6dfe37"
|
||||
},
|
||||
"Name": "RSA-2048 public key",
|
||||
"Key": {
|
||||
"Size": 2048
|
||||
},
|
||||
"Relationships": [
|
||||
{
|
||||
"Type": "used_with",
|
||||
"RelatedAsset": "algorithm:oid:1.2.840.113549.1.1.1:key-size%3D2048"
|
||||
}
|
||||
],
|
||||
"FilePath": "opt/app/app.jks",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "fc98df1c4f92c7d1",
|
||||
"Kind": "key",
|
||||
@@ -2446,6 +2916,30 @@
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AssetID": "bd12d32fdb8fb119",
|
||||
"Kind": "key",
|
||||
"KeyType": "public",
|
||||
"Identity": {
|
||||
"Method": "spki-sha256",
|
||||
"Value": "f7899050cfc485328d86af4668f4626a21f5ebe243a7db920d40a51a2e6dfe37"
|
||||
},
|
||||
"Name": "RSA-2048 public key",
|
||||
"Key": {
|
||||
"Size": 2048
|
||||
},
|
||||
"Relationships": [
|
||||
{
|
||||
"Type": "used_with",
|
||||
"RelatedAsset": "algorithm:oid:1.2.840.113549.1.1.1:key-size%3D2048"
|
||||
}
|
||||
],
|
||||
"FilePath": "opt/java/jdk-8/jre/lib/security/cacerts",
|
||||
"Layer": {
|
||||
"Digest": "sha256:ec2035faa60e152a6d26159f920d4f5faef9df5fb555d93952b68f42467ac203",
|
||||
"DiffID": "sha256:7c6de831d8d17bab922424c2fe6bcc7310f351947d7c7ac942c65538742cba20"
|
||||
}
|
||||
}
|
||||
],
|
||||
"CryptoFindings": [
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package jks
|
||||
|
||||
// MaxCertificates exports maxCertificates for testing.
|
||||
const MaxCertificates = maxCertificates
|
||||
@@ -0,0 +1,145 @@
|
||||
package jks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"iter"
|
||||
|
||||
"golang.org/x/crypto/cryptobyte"
|
||||
|
||||
"github.com/aquasecurity/trivy/pkg/crypto/parser/x509"
|
||||
ftypes "github.com/aquasecurity/trivy/pkg/fanal/types"
|
||||
"github.com/aquasecurity/trivy/pkg/log"
|
||||
)
|
||||
|
||||
// The layout follows the engineStore method of sun.security.provider.JavaKeyStore, as the
|
||||
// format has no specification. See
|
||||
// https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/sun/security/provider/JavaKeyStore.java
|
||||
const (
|
||||
magic = 0xFEEDFEED
|
||||
|
||||
// version1 stores certificates without their type, which is always X.509.
|
||||
version1 = 1
|
||||
version2 = 2
|
||||
|
||||
tagPrivateKey = 1
|
||||
tagTrustedCert = 2
|
||||
)
|
||||
|
||||
// maxCertificates bounds the number of X.509 certificates read from one keystore. A real trust
|
||||
// store holds a few hundred.
|
||||
const maxCertificates = 10000
|
||||
|
||||
const certificateTypeX509 = "X.509"
|
||||
|
||||
// ErrNotJKS means that the content is not a JKS file.
|
||||
var ErrNotJKS = errors.New("not a JKS file")
|
||||
|
||||
// Parse describes the certificates of a JKS keystore as assets.
|
||||
//
|
||||
// Content that is not a JKS file gives ErrNotJKS. Material that cannot be read is logged
|
||||
// and skipped. Any other error means a parsed certificate could not be described.
|
||||
func Parse(ctx context.Context, filePath string, content []byte) ([]ftypes.CryptoAsset, error) {
|
||||
s := cryptobyte.String(content)
|
||||
var m uint32
|
||||
if !s.ReadUint32(&m) || m != magic {
|
||||
return nil, ErrNotJKS
|
||||
}
|
||||
ctx = log.WithContextPrefix(ctx, "jks")
|
||||
ctx = log.WithContextAttrs(ctx, log.FilePath(filePath))
|
||||
return x509.ParseCertificates(ctx, filePath, certificates(ctx, s), ftypes.CryptoKeystoreJKS)
|
||||
}
|
||||
|
||||
// certificates yields the DER of each trusted certificate and of each certificate in the
|
||||
// chain of a private key.
|
||||
func certificates(ctx context.Context, data []byte) iter.Seq[[]byte] {
|
||||
return func(yield func([]byte) bool) {
|
||||
s := cryptobyte.String(data)
|
||||
var version, count uint32
|
||||
if !s.ReadUint32(&version) || !s.ReadUint32(&count) {
|
||||
log.WarnContext(ctx, "Malformed JKS file")
|
||||
return
|
||||
}
|
||||
if version != version1 && version != version2 {
|
||||
log.WarnContext(ctx, "Unsupported JKS version", log.Int("version", int(version)))
|
||||
return
|
||||
}
|
||||
|
||||
budget := maxCertificates
|
||||
next := func(der []byte) bool {
|
||||
if budget == 0 {
|
||||
log.WarnContext(ctx, "Too many JKS certificates")
|
||||
return false
|
||||
}
|
||||
budget--
|
||||
return yield(der)
|
||||
}
|
||||
|
||||
// An entry carries no length of its own, so the rest of the file is lost after a
|
||||
// malformed entry.
|
||||
for range count {
|
||||
var tag uint32
|
||||
var alias cryptobyte.String
|
||||
if !s.ReadUint32(&tag) || !s.ReadUint16LengthPrefixed(&alias) || !s.Skip(8) {
|
||||
log.WarnContext(ctx, "Malformed JKS entry")
|
||||
return
|
||||
}
|
||||
|
||||
var ok bool
|
||||
switch tag {
|
||||
case tagPrivateKey:
|
||||
ok = readPrivateKeyEntry(ctx, &s, version, next)
|
||||
case tagTrustedCert:
|
||||
ok = readCertificate(ctx, &s, version, next)
|
||||
default:
|
||||
log.WarnContext(ctx, "Malformed JKS entry", log.Int("tag", int(tag)))
|
||||
return
|
||||
}
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// readPrivateKeyEntry skips the encrypted key of an entry and yields the certificates of
|
||||
// its chain. It reports whether reading can continue.
|
||||
func readPrivateKeyEntry(ctx context.Context, s *cryptobyte.String, version uint32, yield func([]byte) bool) bool {
|
||||
var keyLen, chainLen uint32
|
||||
if !s.ReadUint32(&keyLen) || !s.Skip(int(keyLen)) || !s.ReadUint32(&chainLen) {
|
||||
log.WarnContext(ctx, "Malformed JKS entry")
|
||||
return false
|
||||
}
|
||||
for range chainLen {
|
||||
if !readCertificate(ctx, s, version, yield) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// readCertificate yields one certificate of an entry. It reports whether reading can
|
||||
// continue.
|
||||
func readCertificate(ctx context.Context, s *cryptobyte.String, version uint32, yield func([]byte) bool) bool {
|
||||
certType := certificateTypeX509
|
||||
if version == version2 {
|
||||
var t cryptobyte.String
|
||||
if !s.ReadUint16LengthPrefixed(&t) {
|
||||
log.WarnContext(ctx, "Malformed JKS certificate")
|
||||
return false
|
||||
}
|
||||
certType = string(t)
|
||||
}
|
||||
|
||||
var certLen uint32
|
||||
var der []byte
|
||||
if !s.ReadUint32(&certLen) || !s.ReadBytes(&der, int(certLen)) {
|
||||
log.WarnContext(ctx, "Malformed JKS certificate")
|
||||
return false
|
||||
}
|
||||
if certType != certificateTypeX509 {
|
||||
log.DebugContext(ctx, "Unsupported JKS certificate type", log.String("cert_type", certType))
|
||||
return true
|
||||
}
|
||||
return yield(der)
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
package jks_test
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"crypto/elliptic"
|
||||
"crypto/rand"
|
||||
stdx509 "crypto/x509"
|
||||
"crypto/x509/pkix"
|
||||
"math/big"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/crypto/cryptobyte"
|
||||
|
||||
"github.com/aquasecurity/trivy/pkg/crypto/parser/jks"
|
||||
ftypes "github.com/aquasecurity/trivy/pkg/fanal/types"
|
||||
)
|
||||
|
||||
// parsedFilePath is the path every keystore is parsed from.
|
||||
const parsedFilePath = "keystore.jks"
|
||||
|
||||
func TestParse(t *testing.T) {
|
||||
certificate := newCertificate(t, "example.test")
|
||||
other := newCertificate(t, "other.example.test")
|
||||
|
||||
// The last 30 bytes are the 20-byte integrity hash and the end of the second certificate.
|
||||
truncated := keystore(2,
|
||||
trustedCertEntry(2, "X.509", certificate),
|
||||
trustedCertEntry(2, "X.509", other),
|
||||
)
|
||||
truncated = truncated[:len(truncated)-30]
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
content []byte
|
||||
want []string
|
||||
wantErr error
|
||||
}{
|
||||
{
|
||||
name: "keytool trust store",
|
||||
content: fixture(t, "keytool-truststore.jks"),
|
||||
want: []string{"keytool-second.example.test", "keytool-first.example.test"},
|
||||
},
|
||||
{
|
||||
name: "keytool keystore with a private key",
|
||||
content: fixture(t, "keytool-keystore.jks"),
|
||||
want: []string{"keytool-key.example.test"},
|
||||
},
|
||||
{
|
||||
name: "version 1",
|
||||
content: keystore(1, trustedCertEntry(1, "X.509", certificate)),
|
||||
want: []string{"example.test"},
|
||||
},
|
||||
{
|
||||
name: "private key with a chain",
|
||||
content: keystore(2, privateKeyEntry(2, []byte{0x01}, certificate, other)),
|
||||
want: []string{"example.test", "other.example.test"},
|
||||
},
|
||||
{
|
||||
name: "repeated certificate",
|
||||
content: keystore(2,
|
||||
privateKeyEntry(2, []byte{0x01}, certificate),
|
||||
trustedCertEntry(2, "X.509", certificate),
|
||||
),
|
||||
want: []string{"example.test"},
|
||||
},
|
||||
{
|
||||
name: "certificate of another type",
|
||||
content: keystore(2,
|
||||
trustedCertEntry(2, "PGP", []byte{0x01}),
|
||||
trustedCertEntry(2, "X.509", certificate),
|
||||
),
|
||||
want: []string{"example.test"},
|
||||
},
|
||||
{
|
||||
name: "malformed certificate",
|
||||
content: keystore(2,
|
||||
trustedCertEntry(2, "X.509", []byte("malformed")),
|
||||
trustedCertEntry(2, "X.509", certificate),
|
||||
),
|
||||
want: []string{"example.test"},
|
||||
},
|
||||
{
|
||||
name: "truncated entry",
|
||||
content: truncated,
|
||||
want: []string{"example.test"},
|
||||
},
|
||||
{
|
||||
name: "unknown entry tag",
|
||||
content: keystore(2,
|
||||
trustedCertEntry(2, "X.509", certificate),
|
||||
entry(3, func(*cryptobyte.Builder) {}),
|
||||
trustedCertEntry(2, "X.509", other),
|
||||
),
|
||||
want: []string{"example.test"},
|
||||
},
|
||||
{
|
||||
name: "no entries",
|
||||
content: keystore(2),
|
||||
},
|
||||
{
|
||||
name: "unsupported version",
|
||||
content: keystore(3, trustedCertEntry(2, "X.509", certificate)),
|
||||
},
|
||||
{
|
||||
name: "private key longer than the file",
|
||||
content: keystore(2,
|
||||
trustedCertEntry(2, "X.509", certificate),
|
||||
entry(1, func(b *cryptobyte.Builder) {
|
||||
b.AddUint32(1000)
|
||||
b.AddBytes([]byte{0x01})
|
||||
}),
|
||||
trustedCertEntry(2, "X.509", other),
|
||||
),
|
||||
want: []string{"example.test"},
|
||||
},
|
||||
{
|
||||
name: "certificates at the limit",
|
||||
content: keystore(2,
|
||||
privateKeyEntry(2, []byte{0x01}, slices.Repeat([][]byte{certificate}, jks.MaxCertificates-1)...),
|
||||
trustedCertEntry(2, "X.509", other),
|
||||
),
|
||||
want: []string{"example.test", "other.example.test"},
|
||||
},
|
||||
{
|
||||
name: "certificates over the limit",
|
||||
content: keystore(2,
|
||||
privateKeyEntry(2, []byte{0x01}, slices.Repeat([][]byte{certificate}, jks.MaxCertificates)...),
|
||||
trustedCertEntry(2, "X.509", other),
|
||||
),
|
||||
want: []string{"example.test"},
|
||||
},
|
||||
{
|
||||
name: "JCEKS keystore",
|
||||
content: []byte{0xCE, 0xCE, 0xCE, 0xCE, 0x00, 0x00, 0x00, 0x02},
|
||||
wantErr: jks.ErrNotJKS,
|
||||
},
|
||||
{
|
||||
name: "empty file",
|
||||
wantErr: jks.ErrNotJKS,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
assets, err := jks.Parse(t.Context(), parsedFilePath, tt.content)
|
||||
if tt.wantErr != nil {
|
||||
require.ErrorIs(t, err, tt.wantErr)
|
||||
return
|
||||
}
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, tt.want, certificateNames(t, assets))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// certificateNames checks that every asset is valid and returns the names of the
|
||||
// certificates among them.
|
||||
func certificateNames(t *testing.T, assets []ftypes.CryptoAsset) []string {
|
||||
t.Helper()
|
||||
|
||||
var names []string
|
||||
for i, asset := range assets {
|
||||
require.NoErrorf(t, asset.Validate(), "asset %d", i)
|
||||
assert.Equalf(t, parsedFilePath, asset.FilePath, "asset %d", i)
|
||||
if asset.Kind != ftypes.CryptoKindCertificate {
|
||||
continue
|
||||
}
|
||||
assert.Equalf(t, ftypes.CryptoEncodingDER, asset.Encoding, "asset %d", i)
|
||||
assert.Equalf(t, ftypes.CryptoKeystoreJKS, asset.Keystore, "asset %d", i)
|
||||
names = append(names, asset.Name)
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
||||
// fixture reads a keystore from testdata. The keystores are generated from this directory.
|
||||
//
|
||||
// docker run --rm -v "$PWD/testdata:/out" -w /tmp eclipse-temurin:21.0.12.1_1-jdk-alpine-3.24 sh -euc '
|
||||
// keytool -genkeypair -alias key -keyalg EC -groupname secp256r1 -dname CN=keytool-key.example.test -validity 36500 -storetype JKS -keystore /out/keytool-keystore.jks -storepass changeit -keypass changeit
|
||||
// for name in first second; do
|
||||
// keytool -genkeypair -alias $name -keyalg EC -groupname secp256r1 -dname CN=keytool-$name.example.test -validity 36500 -keystore $name.p12 -storepass changeit
|
||||
// keytool -exportcert -rfc -alias $name -keystore $name.p12 -storepass changeit -file $name.pem
|
||||
// keytool -importcert -noprompt -alias $name -file $name.pem -storetype JKS -keystore /out/keytool-truststore.jks -storepass changeit
|
||||
// done
|
||||
// chmod 644 /out/*.jks
|
||||
// '
|
||||
func fixture(t *testing.T, name string) []byte {
|
||||
t.Helper()
|
||||
|
||||
content, err := os.ReadFile(filepath.Join("testdata", name))
|
||||
require.NoError(t, err)
|
||||
return content
|
||||
}
|
||||
|
||||
// keystore stores entries in a JKS file with a zeroed integrity hash.
|
||||
func keystore(version uint32, entries ...[]byte) []byte {
|
||||
var b cryptobyte.Builder
|
||||
b.AddUint32(0xFEEDFEED)
|
||||
b.AddUint32(version)
|
||||
b.AddUint32(uint32(len(entries)))
|
||||
for _, e := range entries {
|
||||
b.AddBytes(e)
|
||||
}
|
||||
b.AddBytes(make([]byte, 20))
|
||||
return b.BytesOrPanic()
|
||||
}
|
||||
|
||||
func entry(tag uint32, body func(*cryptobyte.Builder)) []byte {
|
||||
var b cryptobyte.Builder
|
||||
b.AddUint32(tag)
|
||||
b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) {
|
||||
b.AddBytes([]byte("alias"))
|
||||
})
|
||||
b.AddUint64(0)
|
||||
body(&b)
|
||||
return b.BytesOrPanic()
|
||||
}
|
||||
|
||||
func trustedCertEntry(version uint32, certType string, der []byte) []byte {
|
||||
return entry(2, func(b *cryptobyte.Builder) {
|
||||
addCertificate(b, version, certType, der)
|
||||
})
|
||||
}
|
||||
|
||||
func privateKeyEntry(version uint32, encryptedKey []byte, chain ...[]byte) []byte {
|
||||
return entry(1, func(b *cryptobyte.Builder) {
|
||||
b.AddUint32(uint32(len(encryptedKey)))
|
||||
b.AddBytes(encryptedKey)
|
||||
b.AddUint32(uint32(len(chain)))
|
||||
for _, der := range chain {
|
||||
addCertificate(b, version, "X.509", der)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// addCertificate writes a certificate, which states its type only in version 2.
|
||||
func addCertificate(b *cryptobyte.Builder, version uint32, certType string, der []byte) {
|
||||
if version == 2 {
|
||||
b.AddUint16LengthPrefixed(func(b *cryptobyte.Builder) {
|
||||
b.AddBytes([]byte(certType))
|
||||
})
|
||||
}
|
||||
b.AddUint32(uint32(len(der)))
|
||||
b.AddBytes(der)
|
||||
}
|
||||
|
||||
func newCertificate(t *testing.T, commonName string) []byte {
|
||||
t.Helper()
|
||||
|
||||
key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
|
||||
require.NoError(t, err)
|
||||
|
||||
template := &stdx509.Certificate{
|
||||
SerialNumber: big.NewInt(1),
|
||||
Subject: pkix.Name{CommonName: commonName},
|
||||
NotBefore: time.Unix(1, 0),
|
||||
NotAfter: time.Unix(2, 0),
|
||||
}
|
||||
der, err := stdx509.CreateCertificate(rand.Reader, template, template, &key.PublicKey, key)
|
||||
require.NoError(t, err)
|
||||
return der
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/aquasecurity/trivy/pkg/crypto/parser/jks"
|
||||
"github.com/aquasecurity/trivy/pkg/crypto/parser/pkcs12"
|
||||
"github.com/aquasecurity/trivy/pkg/crypto/parser/x509"
|
||||
"github.com/aquasecurity/trivy/pkg/fanal/analyzer"
|
||||
@@ -36,11 +37,8 @@ var (
|
||||
|
||||
keystoreExtensions = set.NewCaseInsensitive(".p12", ".pfx", ".jks", ".keystore")
|
||||
|
||||
// jksMagics are the leading bytes of the JKS and JCEKS formats.
|
||||
jksMagics = [][]byte{
|
||||
{0xFE, 0xED, 0xFE, 0xED},
|
||||
{0xCE, 0xCE, 0xCE, 0xCE},
|
||||
}
|
||||
// jceksMagic are the leading bytes of the JCEKS format.
|
||||
jceksMagic = []byte{0xCE, 0xCE, 0xCE, 0xCE}
|
||||
|
||||
// berSequence is the start of a SEQUENCE of indefinite length, which BER allows and
|
||||
// DER does not.
|
||||
@@ -93,17 +91,19 @@ func isKeystore(filePath string) bool {
|
||||
// parse picks the parser by content, because --file-patterns selects files of any name, and
|
||||
// files with the same name or extension may hold different formats.
|
||||
func parse(ctx context.Context, filePath string, content []byte) ([]types.CryptoAsset, error) {
|
||||
for _, magic := range jksMagics {
|
||||
if bytes.HasPrefix(content, magic) {
|
||||
log.WithPrefix("crypto").Debug("Java keystore format is not supported", log.FilePath(filePath))
|
||||
return nil, nil
|
||||
}
|
||||
assets, err := jks.Parse(ctx, filePath, content)
|
||||
if !errors.Is(err, jks.ErrNotJKS) {
|
||||
return assets, err
|
||||
}
|
||||
if bytes.HasPrefix(content, jceksMagic) {
|
||||
log.WithPrefix("crypto").Debug("JCEKS format is not supported", log.FilePath(filePath))
|
||||
return nil, nil
|
||||
}
|
||||
if bytes.HasPrefix(content, berSequence) {
|
||||
log.WithPrefix("crypto").Debug("BER encoding is not supported", log.FilePath(filePath))
|
||||
return nil, nil
|
||||
}
|
||||
assets, err := pkcs12.Parse(ctx, filePath, content)
|
||||
assets, err = pkcs12.Parse(ctx, filePath, content)
|
||||
if !errors.Is(err, pkcs12.ErrNotPKCS12) {
|
||||
return assets, err
|
||||
}
|
||||
|
||||
@@ -116,9 +116,30 @@ func Test_cryptoAnalyzer_Analyze(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Java keystore",
|
||||
name: "JKS trust store",
|
||||
filePath: "usr/lib/jvm/java-11/lib/security/cacerts",
|
||||
content: []byte{0xFE, 0xED, 0xFE, 0xED, 0x00, 0x00, 0x00, 0x02},
|
||||
content: fixtures.jksTruststore,
|
||||
want: []assetSummary{
|
||||
{
|
||||
kind: ftypes.CryptoKindCertificate,
|
||||
name: "jks-cacerts.example.test",
|
||||
encoding: ftypes.CryptoEncodingDER,
|
||||
keystore: ftypes.CryptoKeystoreJKS,
|
||||
},
|
||||
{
|
||||
kind: ftypes.CryptoKindAlgorithm,
|
||||
name: "ECDSA-SHA-384",
|
||||
},
|
||||
{
|
||||
kind: ftypes.CryptoKindKey,
|
||||
keyType: ftypes.CryptoKeyTypePublic,
|
||||
name: "EC-P-256 public key",
|
||||
},
|
||||
{
|
||||
kind: ftypes.CryptoKindAlgorithm,
|
||||
name: "EC-P-256",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Java cryptography extension keystore",
|
||||
@@ -287,6 +308,7 @@ type analyzerFixtures struct {
|
||||
certificatePEM []byte
|
||||
certificateRequestPEM []byte
|
||||
truststore []byte
|
||||
jksTruststore []byte
|
||||
}
|
||||
|
||||
func newAnalyzerFixtures(t *testing.T) analyzerFixtures {
|
||||
@@ -300,7 +322,7 @@ func newAnalyzerFixtures(t *testing.T) analyzerFixtures {
|
||||
}, rsaKey)
|
||||
require.NoError(t, err)
|
||||
|
||||
// The trust store is generated from this directory.
|
||||
// The trust stores are generated from this directory.
|
||||
//
|
||||
// docker run --rm -v "$PWD/testdata:/out" -w /tmp eclipse-temurin:21.0.12.1_1-jdk-alpine-3.24 sh -euc '
|
||||
// keytool -genkeypair -alias cacerts -keyalg EC -groupname secp256r1 -dname CN=cacerts.example.test -validity 36500 -keystore key.p12 -storepass changeit
|
||||
@@ -308,13 +330,23 @@ func newAnalyzerFixtures(t *testing.T) analyzerFixtures {
|
||||
// keytool -importcert -noprompt -alias cacerts -file cacerts.pem -keystore /out/cacerts -storepass changeit -J-Dkeystore.pkcs12.certProtectionAlgorithm=NONE -J-Dkeystore.pkcs12.macAlgorithm=NONE
|
||||
// chmod 644 /out/cacerts
|
||||
// '
|
||||
//
|
||||
// docker run --rm -v "$PWD/testdata:/out" -w /tmp eclipse-temurin:21.0.12.1_1-jdk-alpine-3.24 sh -euc '
|
||||
// keytool -genkeypair -alias cacerts -keyalg EC -groupname secp256r1 -dname CN=jks-cacerts.example.test -validity 36500 -keystore key.p12 -storepass changeit
|
||||
// keytool -exportcert -rfc -alias cacerts -keystore key.p12 -storepass changeit -file cacerts.pem
|
||||
// keytool -importcert -noprompt -alias cacerts -file cacerts.pem -storetype JKS -keystore /out/cacerts.jks -storepass changeit
|
||||
// chmod 644 /out/cacerts.jks
|
||||
// '
|
||||
truststore, err := os.ReadFile("testdata/cacerts")
|
||||
require.NoError(t, err)
|
||||
jksTruststore, err := os.ReadFile("testdata/cacerts.jks")
|
||||
require.NoError(t, err)
|
||||
|
||||
return analyzerFixtures{
|
||||
certificatePEM: encodePEM("CERTIFICATE", createCertificate(t, rsaKey)),
|
||||
certificateRequestPEM: encodePEM("CERTIFICATE REQUEST", certificateRequestDER),
|
||||
truststore: truststore,
|
||||
jksTruststore: jksTruststore,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
Binary file not shown.
@@ -71,6 +71,8 @@ type CryptoKeystoreType string
|
||||
const (
|
||||
// CryptoKeystorePKCS12 identifies a PKCS#12 keystore.
|
||||
CryptoKeystorePKCS12 CryptoKeystoreType = "PKCS#12"
|
||||
// CryptoKeystoreJKS identifies a JKS keystore.
|
||||
CryptoKeystoreJKS CryptoKeystoreType = "JKS"
|
||||
)
|
||||
|
||||
// CryptoAssetInfo describes a format-neutral cryptographic asset. Its identity is derived
|
||||
@@ -264,7 +266,7 @@ func (a CryptoAsset) Validate() error {
|
||||
}
|
||||
|
||||
switch a.Keystore {
|
||||
case "", CryptoKeystorePKCS12:
|
||||
case "", CryptoKeystorePKCS12, CryptoKeystoreJKS:
|
||||
default:
|
||||
return xerrors.Errorf("unknown keystore type %q", a.Keystore)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user