Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions common/src/main/java/org/conscrypt/OpenSslMlDsaKeyFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecE
NativeConstants.EVP_PKEY_ML_DSA_87}));
return makePublicKey(key);
} catch (OpenSSLX509CertificateFactory.ParsingException e) {
throw new InvalidKeySpecException("Invalid X.509 encoding", e);
throw new InvalidKeySpecException(
"Unable to parse key. Only ML-DSA-65 and ML-DSA-87 are currently supported.",
e);
}
}

Expand Down Expand Up @@ -204,7 +206,11 @@ protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpe
NativeConstants.EVP_PKEY_ML_DSA_87}));
return makePrivateKey(key);
} catch (OpenSSLX509CertificateFactory.ParsingException e) {
throw new InvalidKeySpecException("Invalid PKCS8 encoding", e);
throw new InvalidKeySpecException(
"Unable to parse key. Only ML-DSA-65 and ML-DSA-87 are currently supported. "
+ "Please use ML-DSA 'seed format' as specified and recommended "
+ "in RFC 9881.",
e);
}
}

Expand Down
Loading