diff --git a/src/java.base/share/classes/com/sun/crypto/provider/DHKeyAgreement.java b/src/java.base/share/classes/com/sun/crypto/provider/DHKeyAgreement.java index 7ab85b097a100..2d9ad93d2fa29 100644 --- a/src/java.base/share/classes/com/sun/crypto/provider/DHKeyAgreement.java +++ b/src/java.base/share/classes/com/sun/crypto/provider/DHKeyAgreement.java @@ -380,10 +380,9 @@ protected SecretKey engineGenerateSecret(String algorithm) } if (!KeyUtil.isSupportedKeyAgreementOutputAlgorithm(algorithm) && - !AllowKDF.VALUE) { - - throw new NoSuchAlgorithmException("Unsupported secret key " - + "algorithm: " + algorithm); + !AllowKDF.VALUE) { + throw new NoSuchAlgorithmException( + "Unsupported secret key algorithm: " + algorithm); } byte[] secret = engineGenerateSecret(); @@ -429,7 +428,7 @@ protected SecretKey engineGenerateSecret(String algorithm) } } else { throw new NoSuchAlgorithmException( - "Unsupported secret key algorithm " + algorithm); + "Unsupported secret key algorithm: " + algorithm); } } } diff --git a/src/java.base/share/classes/javax/crypto/KeyAgreement.java b/src/java.base/share/classes/javax/crypto/KeyAgreement.java index 1beb8e0f9ce71..44e935f08e7dc 100644 --- a/src/java.base/share/classes/javax/crypto/KeyAgreement.java +++ b/src/java.base/share/classes/javax/crypto/KeyAgreement.java @@ -672,7 +672,7 @@ public final int generateSecret(byte[] sharedSecret, int offset) * may be adjusted to be compatible with the specified algorithm, * regardless of whether the key is extractable. If {@code algorithm} * is specified as "Generic" and it is supported by the implementation, - * the full shared secret will be returned. + * the full shared secret is returned. * * @exception IllegalStateException if this key agreement has not been * initialized or if {@code doPhase} has not been called to supply the diff --git a/src/java.base/share/classes/javax/crypto/KeyAgreementSpi.java b/src/java.base/share/classes/javax/crypto/KeyAgreementSpi.java index d85eaf559d96a..5bad5bfa49005 100644 --- a/src/java.base/share/classes/javax/crypto/KeyAgreementSpi.java +++ b/src/java.base/share/classes/javax/crypto/KeyAgreementSpi.java @@ -218,7 +218,7 @@ protected abstract int engineGenerateSecret(byte[] sharedSecret, * may be adjusted to be compatible with the specified algorithm, * regardless of whether the key is extractable. If {@code algorithm} * is specified as "Generic" and it is supported by the implementation, - * the full shared secret will be returned. + * the full shared secret is returned. * * @exception IllegalStateException if this key agreement has not been * initialized or if {@code doPhase} has not been called to supply the diff --git a/src/java.base/share/classes/sun/security/ec/ECDHKeyAgreement.java b/src/java.base/share/classes/sun/security/ec/ECDHKeyAgreement.java index f46acc68824cf..8f6bdb8d80ae1 100644 --- a/src/java.base/share/classes/sun/security/ec/ECDHKeyAgreement.java +++ b/src/java.base/share/classes/sun/security/ec/ECDHKeyAgreement.java @@ -257,7 +257,7 @@ protected SecretKey engineGenerateSecret(String algorithm) } if (!KeyUtil.isSupportedKeyAgreementOutputAlgorithm(algorithm)) { throw new NoSuchAlgorithmException( - "Unsupported secret key algorithm " + algorithm); + "Unsupported secret key algorithm: " + algorithm); } return new SecretKeySpec(engineGenerateSecret(), algorithm); } diff --git a/src/java.base/share/classes/sun/security/ec/XDHKeyAgreement.java b/src/java.base/share/classes/sun/security/ec/XDHKeyAgreement.java index 4675fb43b0528..01dce4c53e905 100644 --- a/src/java.base/share/classes/sun/security/ec/XDHKeyAgreement.java +++ b/src/java.base/share/classes/sun/security/ec/XDHKeyAgreement.java @@ -211,7 +211,7 @@ protected SecretKey engineGenerateSecret(String algorithm) if (!KeyUtil.isSupportedKeyAgreementOutputAlgorithm(algorithm)) { throw new NoSuchAlgorithmException( - "Unsupported secret key algorithm " + algorithm); + "Unsupported secret key algorithm: " + algorithm); } return new SecretKeySpec(engineGenerateSecret(), algorithm); } diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECDHKeyAgreement.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECDHKeyAgreement.java index 9e4231c78d59e..ec5e03cc15a67 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECDHKeyAgreement.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECDHKeyAgreement.java @@ -172,7 +172,7 @@ protected SecretKey engineGenerateSecret(String algorithm) } if (!KeyUtil.isSupportedKeyAgreementOutputAlgorithm(algorithm)) { throw new NoSuchAlgorithmException( - "Unsupported secret key algorithm " + algorithm); + "Unsupported secret key algorithm: " + algorithm); } return nativeGenerateSecret(algorithm); } diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyAgreement.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyAgreement.java index 82f3cea33ffce..183135ce7e126 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyAgreement.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyAgreement.java @@ -270,7 +270,8 @@ protected SecretKey engineGenerateSecret(String algorithm) if (KeyUtil.isSupportedKeyAgreementOutputAlgorithm(algorithm)) { // For now, only perform native derivation for TlsPremasterSecret - // as that is required for FIPS compliance and Generic for KDF. + // and Generic algorithms. TlsPremasterSecret is required for + // FIPS compliance and Generic is required for input to KDF. // For other algorithms, there are unresolved issues regarding // how this should work in JCE plus a Solaris truncation bug. // (bug not yet filed). @@ -279,7 +280,7 @@ protected SecretKey engineGenerateSecret(String algorithm) if (!AllowKDF.VALUE) { throw new NoSuchAlgorithmException( - "Unsupported secret key algorithm " + algorithm); + "Unsupported secret key algorithm: " + algorithm); } byte[] secret = engineGenerateSecret();