Crypto-View

Mastercard/client-encryption-java

Cryptographic posture

66 cryptographic locations: 10 quantum-vulnerable, 23 reduced-margin, 22 undetermined, 11 quantum-safe

10 establish keys, so traffic protected by them and recorded today becomes readable once the algorithm falls. 1 imported cryptographic library is listed separately. 51 files analysed.

Quantum-vulnerable 10 Reduced margin 23 Could not be determined 22 Quantum-safe 11
To address32
Key establishment10
Inventory only1
Total findings67
What was analysed
Branch main
Commit 8fcce7175f17fd3fa355e720a97693cf1b05ae69 Merge pull request #128 from maheshshinde9100/fix/127-aes-jwe-utf8-charset
Committed 2026-10-22 10:37 UTC
Scanned 2026-10-22 12:42 UTC 28 days ago
Coverage 51 files, 44 java
56 test files not scanned

Earlier scans of this repository

4 scans · compare any two
0 to 50 locations Already broken 4 → 0 (down 4) Quantum-vulnerable 15 → 14 (down 1) Reduced margin 37 → 27 (down 10) Could not be determined 27 → 22 (down 5) Quantum-safe 21 → 10 (down 11) The filled point is the scan you are reading.
Scanned Commit To address Key establishment
27 days ago 8fcce7175f17 main 40 14 Compare
28 days ago 8fcce7175f17 main 40 14 Compare
28 days ago this scan 8fcce7175f17 main 32 10
29 days ago 706794ea1904 53 15 Compare

A repository is scanned again when someone asks: Run a fresh scan.

List of cryptographic assets

RSA-OAEP Quantum-vulnerable Recorded traffic From a constant 4 places See details

Classical public-key cipher through the JCA

`Cipher.getInstance()` with a transformation whose algorithm component is a public-key or legacy symmetric cipher. The transformation string is parsed into algorithm, mode and padding, so `RSA/ECB/PKCS1Padding` is separated from `RSA/ECB/OAEPWithSHA-256AndMGF1Padding`.

A quantum computer of sufficient size breaks this completely. It has to be replaced, not tuned. Broken by Shor's algorithm on a cryptographically relevant quantum computer.

What to do. For RSA encryption, move to ML-KEM-768 and keep RSA-OAEP only as the classical half of a hybrid during transition.

  1. src/main/java/com/mastercard/developer/encryption/rsa/RSA.java:27 Cipher cipher = Cipher.getInstance(asymmetricCipher);
  2. src/main/java/com/mastercard/developer/encryption/rsa/RSA.java:29 return cipher.wrap(privateKey);
  3. src/main/java/com/mastercard/developer/encryption/rsa/RSA.java:42 Cipher cipher = Cipher.getInstance(asymmetricCipher);
  4. src/main/java/com/mastercard/developer/encryption/rsa/RSA.java:44 return cipher.unwrap(keyBytes, SYMMETRIC_KEY_TYPE, Cipher.SECRET_KEY);
java.cipher · CWE-327
RSA-OAEP Quantum-vulnerable Recorded traffic 3 places See details

Cipher transformation named away from the call

A JCA transformation string - `algorithm/mode/padding` - written somewhere other than a `getInstance()` argument, which is how a codebase that centralises its cryptography passes the choice to a helper. The string is unambiguous wherever it appears: nothing but a transformation is spelled that way.

This names an encryption method as text, and passes it to code elsewhere that does the work. It is the same choice, made in a different place.

What to do. The same migration applies as to the call that consumes it. Move the constant and the call together, so the inventory keeps naming the algorithm after the change.

  1. src/main/java/com/mastercard/developer/encryption/rsa/RSA.java:20 private static final String ASYMMETRIC_CYPHER = "RSA/ECB/OAEPWith{ALG}AndMGF1Padding";
  2. src/main/java/com/mastercard/developer/encryption/rsa/RSA.java:26 String asymmetricCipher = ASYMMETRIC_CYPHER.replace("{ALG}", mgf1ParameterSpec.getDigestAlgorithm());
  3. src/main/java/com/mastercard/developer/encryption/rsa/RSA.java:41 String asymmetricCipher = ASYMMETRIC_CYPHER.replace("{ALG}", mgf1ParameterSpec.getDigestAlgorithm());
java.transformation · CWE-327
RSA-OAEP-SHA256 Quantum-vulnerable Recorded traffic 2 places See details

JOSE algorithm declared in configuration

An `alg` value in JSON or YAML. `none` is reported as a critical defect; HS* is an HMAC and is not quantum-vulnerable; RS*, PS*, ES* and EdDSA are.

A quantum computer of sufficient size breaks this completely. It has to be replaced, not tuned. Broken by Shor's algorithm on a cryptographically relevant quantum computer.

What to do. No standardised post-quantum JOSE algorithm exists yet. Keep token lifetimes short.

  1. src/main/java/com/mastercard/developer/encryption/JweEncryption.java:20 private static final String ALGORITHM = "RSA-OAEP-256";
  2. src/main/java/com/mastercard/developer/encryption/JweEncryption.java:90 JweHeader myHeader = new JweHeader(ALGORITHM, ENCRYPTION, config.encryptionKeyFingerprint, CONTENT_TYPE);
jose.algorithm · CWE-327
RSA Quantum-vulnerable Recorded traffic 1 place See details

Classical key material handled through the JCA

`KeyFactory.getInstance()` for a classical algorithm. This indicates the code parses or produces keys of that family, which is a migration surface even where it does no cryptography itself.

A quantum computer of sufficient size breaks this completely. It has to be replaced, not tuned. Broken by Shor's algorithm on a cryptographically relevant quantum computer.

What to do. Include this code path in the inventory: it has to accept post-quantum key encodings before the keys themselves can change.

  1. src/main/java/com/mastercard/developer/utils/EncryptionUtils.java:99 KeyFactory keyFactory = KeyFactory.getInstance("RSA");
java.keyfactory · CWE-327
AES Reduced margin From a constant 6 places See details

Classical public-key cipher through the JCA

`Cipher.getInstance()` with a transformation whose algorithm component is a public-key or legacy symmetric cipher. The transformation string is parsed into algorithm, mode and padding, so `RSA/ECB/PKCS1Padding` is separated from `RSA/ECB/OAEPWithSHA-256AndMGF1Padding`.

A quantum computer weakens this but does not break it. Increasing the key or digest size restores the margin. Grover's algorithm halves the effective strength; the parameter, not the design, is the problem. The key size was not visible at this call site, so the weaker case is assumed.

What to do. For RSA encryption, move to ML-KEM-768 and keep RSA-OAEP only as the classical half of a hybrid during transition.

java.cipher · CWE-327
AES Reduced margin 3 places See details

Key material constructed for a named algorithm

`new SecretKeySpec(bytes, "AES")` and the other key-spec constructors name the algorithm as an argument rather than through `getInstance()`. Code that wraps raw bytes into a key this way often never calls `getInstance()` at all, so the algorithm is invisible to a scan that only looks at the factories.

This wraps raw bytes into a key for a named algorithm. It is part of the same migration as whatever uses that key.

What to do. Wherever this key is used, the same migration applies as to the call that consumes it. Trace it to the operation and treat the two together.

  1. src/main/java/com/mastercard/developer/encryption/aes/AESCBC.java:23 SecretKeySpec aesKey = new SecretKeySpec(secretKey.getEncoded(), 16, 16, "AES");
  2. src/main/java/com/mastercard/developer/encryption/aes/AESEncryption.java:32 return new SecretKeySpec(cekMaterial, "AES");
  3. src/main/java/com/mastercard/developer/encryption/jwe/JweObject.java:74 SecretKeySpec aesKey = new SecretKeySpec(cek.getEncoded(), "AES");
java.keyspec · CWE-327
AES Reduced margin 2 places See details

Cipher transformation named away from the call

A JCA transformation string - `algorithm/mode/padding` - written somewhere other than a `getInstance()` argument, which is how a codebase that centralises its cryptography passes the choice to a helper. The string is unambiguous wherever it appears: nothing but a transformation is spelled that way.

This names an encryption method as text, and passes it to code elsewhere that does the work. It is the same choice, made in a different place.

What to do. The same migration applies as to the call that consumes it. Move the constant and the call together, so the inventory keeps naming the algorithm after the change.

  1. src/main/java/com/mastercard/developer/encryption/aes/AESCBC.java:18 private static final String CYPHER = "AES/CBC/PKCS5Padding";
  2. src/main/java/com/mastercard/developer/encryption/aes/AESGCM.java:19 private static final String CYPHER = "AES/GCM/NoPadding";
java.transformation · CWE-327
AES Reduced margin 2 places See details

Algorithm named in a setting

A setting whose name says it holds an algorithm, given a literal that names one: `withOaepPaddingDigestAlgorithm("SHA-512")`, `signatureAlgorithm = "SHA256withRSA"`, `"digestAlgorithm": "SHA-256"`. The algorithm never reaches a `getInstance()` in this file - it is carried to one somewhere else, often through configuration - so a scan that only reads the factories cannot see it at all.

Something here is configured to use a named algorithm. The code that uses it may be somewhere else entirely, but this is the line that decides which algorithm it is.

What to do. Find what consumes the setting. The migration belongs to that operation; this line is where the choice is actually written down, and usually where it is easiest to change.

  1. src/main/java/com/mastercard/developer/encryption/FieldLevelEncryptionParams.java:21 static final String SYMMETRIC_KEY_TYPE = "AES";
  2. src/main/java/com/mastercard/developer/encryption/rsa/RSA.java:21 private static final String SYMMETRIC_KEY_TYPE = "AES";
config.algorithm-setting · CWE-327
SHA-256 Reduced margin 2 places See details

Call to code named for an algorithm

A call, construction or operation whose own name states the algorithm: a project's wrapper such as `Hash.sha256(data)`, `hmacSha256(key, msg)`, `getMD5()` or `new ScryptGenerator(..)`, a key type such as `new Ed25519PublicKey(bytes)`, or an operation on an object named for its algorithm, `sha256.digest()`. The library call inside the wrapper is reported where it is written; these are the places it is used.

This line calls code named after an encryption or hashing method.

What to do. Migrate the wrapper once, and these call sites follow it.

  1. src/main/java/com/mastercard/developer/encryption/EncryptionConfigBuilder.java:43 final byte[] keyFingerprintBytes = sha256digestBytes(publicKey.getEncoded());
  2. src/main/java/com/mastercard/developer/encryption/FieldLevelEncryptionConfigBuilder.java:290 byte[] certificateFingerprintBytes = sha256digestBytes(encryptionCertificate.getEncoded());
code.named-call
SHA-256 Reduced margin 2 places See details

Hash algorithm through the JCA

`MessageDigest.getInstance()`. MD5 and SHA-1 are reported as already broken; SHA-256 is reported as a reduced margin rather than a defect.

A quantum computer weakens this but does not break it. Increasing the key or digest size restores the margin. Pre-image resistance falls to about 128 bits of quantum work. Adequate for most uses; SHA-384 restores the full margin where a signature must last decades.

What to do. SHA-256 as the floor, SHA-384 where the digest protects something that must remain verifiable for decades.

java.messagedigest · CWE-328
SHA-256 Reduced margin Renamed import 2 places See details

Mask-generation digest named for RSA padding

`MGF1ParameterSpec.SHA256` names the digest inside RSA-OAEP and RSA-PSS padding. It is a separate choice from the digest the signature or the cipher uses, it is frequently left at SHA-1 by default, and a static import of it - `import static java.security.spec.MGF1ParameterSpec.SHA512` - is the only place the choice appears in the file that makes it.

This picks the hash used inside RSA padding. It matters because the default is often SHA-1, which is broken today without any quantum computer.

What to do. The mask-generation digest travels with the RSA key it pads. When that key moves to ML-KEM or ML-DSA the padding goes with it; until then, SHA-256 or better.

  1. src/main/java/com/mastercard/developer/encryption/FieldLevelEncryptionConfigBuilder.java:8 import static java.security.spec.MGF1ParameterSpec.SHA256;
  2. src/main/java/com/mastercard/developer/encryption/FieldLevelEncryptionConfigBuilder.java:242 if (!SHA256.getDigestAlgorithm().equals(oaepPaddingDigestAlgorithm)
java.mgf1 · CWE-327
AES-128-CBC Reduced margin 2 places See details

JOSE algorithm declared in configuration

An `alg` value in JSON or YAML. `none` is reported as a critical defect; HS* is an HMAC and is not quantum-vulnerable; RS*, PS*, ES* and EdDSA are.

A quantum computer weakens this but does not break it. Increasing the key or digest size restores the margin. Grover's algorithm halves the effective strength; the parameter, not the design, is the problem.

What to do. No standardised post-quantum JOSE algorithm exists yet. Keep token lifetimes short.

  1. src/main/java/com/mastercard/developer/encryption/jwe/JweObject.java:31 private static final String A128CBC_HS256 = "A128CBC-HS256";
  2. src/main/java/com/mastercard/developer/encryption/jwe/JweObject.java:51 } else if (encryptionMethod.equals(A128CBC_HS256)) {
jose.algorithm · CWE-327
AES-128-GCM Reduced margin 1 place See details

JOSE algorithm declared in configuration

An `alg` value in JSON or YAML. `none` is reported as a critical defect; HS* is an HMAC and is not quantum-vulnerable; RS*, PS*, ES* and EdDSA are.

A quantum computer weakens this but does not break it. Increasing the key or digest size restores the margin. Grover's algorithm halves the effective strength; the parameter, not the design, is the problem.

What to do. No standardised post-quantum JOSE algorithm exists yet. Keep token lifetimes short.

  1. src/main/java/com/mastercard/developer/encryption/jwe/JweObject.java:32 private static final List<String> AES_GCM_ENCRYPTION_METHODS = Arrays.asList("A128GCM", "A192GCM", "A256GCM");
jose.algorithm · CWE-327
AES-192-GCM Reduced margin 1 place See details

JOSE algorithm declared in configuration

An `alg` value in JSON or YAML. `none` is reported as a critical defect; HS* is an HMAC and is not quantum-vulnerable; RS*, PS*, ES* and EdDSA are.

A quantum computer weakens this but does not break it. Increasing the key or digest size restores the margin. Grover's algorithm halves the effective strength; the parameter, not the design, is the problem.

What to do. No standardised post-quantum JOSE algorithm exists yet. Keep token lifetimes short.

  1. src/main/java/com/mastercard/developer/encryption/jwe/JweObject.java:32 private static final List<String> AES_GCM_ENCRYPTION_METHODS = Arrays.asList("A128GCM", "A192GCM", "A256GCM");
jose.algorithm · CWE-327
X.509 Could not be determined 2 places See details

X.509 certificate handled in code

A certificate, signing request or revocation list loaded, parsed or created: `x509.load_pem_x509_certificate()`, `x509.ParseCertificate()`, `CertificateFactory.generateCertificate()`, `new X509Certificate()`. Certificates are the longest-lived cryptographic artefacts most systems own.

This code reads or builds a digital identity document. Its key, and how long it stays valid, decide when it has to be replaced.

What to do. Shorten certificate lifetimes now, so re-issuing with a post-quantum key is routine rather than an incident.

  1. src/main/java/com/mastercard/developer/utils/EncryptionUtils.java:43 CertificateFactory factory = CertificateFactory.getInstance("X.509");
  2. src/main/java/com/mastercard/developer/utils/EncryptionUtils.java:44 return factory.generateCertificate(certificateStream);
x509.certificate
unknown Could not be determined 1 place See details

Key store holding classical key material

`KeyStore.getInstance("JKS"|"PKCS12"|"BCFKS")`. The store format itself is not the issue; it is the inventory point where the classical private keys of this application live.

This is the application's key cupboard. It is worth knowing what is in it before planning any replacement.

What to do. Record which keys this store holds. A key store is where a migration either happens or silently does not.

  1. src/main/java/com/mastercard/developer/utils/EncryptionUtils.java:90 KeyStore pkcs12KeyStore = KeyStore.getInstance("PKCS12");
java.keystore
CSPRNG Quantum-safe 4 places See details

Random number generation

`SecureRandom`. A platform CSPRNG is not a quantum exposure; it is recorded because an inventory that omits the randomness source is incomplete. `SHA1PRNG` is named explicitly where it appears, since it is a legacy algorithm even though its output is adequate.

This is where the software gets its random numbers. Quantum computers do not weaken it.

What to do. No action. Prefer the platform default over naming an algorithm.

java.rng
AES-256-GCM Quantum-safe 3 places See details

JOSE algorithm declared in configuration

An `alg` value in JSON or YAML. `none` is reported as a critical defect; HS* is an HMAC and is not quantum-vulnerable; RS*, PS*, ES* and EdDSA are.

No known quantum attack changes how strong this is. No known quantum algorithm changes the security margin.

What to do. No standardised post-quantum JOSE algorithm exists yet. Keep token lifetimes short.

  1. src/main/java/com/mastercard/developer/encryption/JweEncryption.java:21 private static final String ENCRYPTION = "A256GCM";
  2. src/main/java/com/mastercard/developer/encryption/JweEncryption.java:90 JweHeader myHeader = new JweHeader(ALGORITHM, ENCRYPTION, config.encryptionKeyFingerprint, CONTENT_TYPE);
  3. src/main/java/com/mastercard/developer/encryption/jwe/JweObject.java:32 private static final List<String> AES_GCM_ENCRYPTION_METHODS = Arrays.asList("A128GCM", "A192GCM", "A256GCM");
jose.algorithm · CWE-327
HMAC-SHA256 Quantum-safe 2 places See details

JOSE algorithm declared in configuration

An `alg` value in JSON or YAML. `none` is reported as a critical defect; HS* is an HMAC and is not quantum-vulnerable; RS*, PS*, ES* and EdDSA are.

No known quantum attack changes how strong this is. A keyed MAC is not affected by Shor and only marginally by Grover.

What to do. No standardised post-quantum JOSE algorithm exists yet. Keep token lifetimes short.

  1. src/main/java/com/mastercard/developer/encryption/jwe/JweObject.java:31 private static final String A128CBC_HS256 = "A128CBC-HS256";
  2. src/main/java/com/mastercard/developer/encryption/jwe/JweObject.java:51 } else if (encryptionMethod.equals(A128CBC_HS256)) {
jose.algorithm · CWE-327
SHA-512 Quantum-safe Renamed import 2 places See details

Mask-generation digest named for RSA padding

`MGF1ParameterSpec.SHA256` names the digest inside RSA-OAEP and RSA-PSS padding. It is a separate choice from the digest the signature or the cipher uses, it is frequently left at SHA-1 by default, and a static import of it - `import static java.security.spec.MGF1ParameterSpec.SHA512` - is the only place the choice appears in the file that makes it.

This picks the hash used inside RSA padding. It matters because the default is often SHA-1, which is broken today without any quantum computer.

What to do. The mask-generation digest travels with the RSA key it pads. When that key moves to ML-KEM or ML-DSA the padding goes with it; until then, SHA-256 or better.

  1. src/main/java/com/mastercard/developer/encryption/FieldLevelEncryptionConfigBuilder.java:9 import static java.security.spec.MGF1ParameterSpec.SHA512;
  2. src/main/java/com/mastercard/developer/encryption/FieldLevelEncryptionConfigBuilder.java:243 && !SHA512.getDigestAlgorithm().equals(oaepPaddingDigestAlgorithm)) {
java.mgf1 · CWE-327

Cryptographic assets

Algorithm Assessment What it means Occurrences
unknown Could not be determined The algorithm could not be established from the source - chosen at runtime, or decided somewhere this scan does not reach. 20
AES Reduced margin Grover's algorithm halves the effective strength; the parameter, not the design, is the problem. The key size was not visible at this call site, so the weaker case is assumed. 13
RSA-OAEP Quantum-vulnerable Broken by Shor's algorithm on a cryptographically relevant quantum computer. 9
SHA-256 Reduced margin Pre-image resistance falls to about 128 bits of quantum work. Adequate for most uses; SHA-384 restores the full margin where a signature must last decades. 6
CSPRNG Quantum-safe A cryptographically secure random number generator provided by the platform. Not weakened by a quantum computer. 4
AES-128 Reduced margin Grover's algorithm halves the effective strength; the parameter, not the design, is the problem. 3
AES-256 Quantum-safe No known quantum algorithm changes the security margin. 3
HMAC Quantum-safe A keyed MAC is not affected by Shor and only marginally by Grover. 2
X.509 Could not be determined An X.509 certificate, signing request or revocation list, or a signature over one. The algorithm is the key's, which this code does not name. 2
SHA-512 Quantum-safe No known quantum algorithm changes the security margin. 2
RSA Quantum-vulnerable Broken by Shor's algorithm on a cryptographically relevant quantum computer. 1
AES-192 Reduced margin Grover's algorithm halves the effective strength; the parameter, not the design, is the problem. 1

Imported cryptographic libraries

Library Files
javax.crypto the JCE 13