From af2e2b70c42610e1d7bde139fa61db169699a8fc Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Mon, 6 Jan 2025 11:10:47 -0500 Subject: [PATCH] revert unrelated changes --- .../share/classes/java/security/Key.java | 7 ++++--- .../java/security/spec/EncodedKeySpec.java | 10 +++++----- .../security/spec/PKCS8EncodedKeySpec.java | 10 +++++----- .../java/security/spec/X509EncodedKeySpec.java | 8 ++++---- .../share/classes/javax/crypto/KDF.java | 8 ++------ .../share/classes/javax/crypto/KDFSpi.java | 10 +++------- .../share/classes/javax/crypto/KEM.java | 18 +++--------------- .../share/classes/javax/crypto/KEMSpi.java | 18 +++--------------- .../javax/crypto/spec/SecretKeySpec.java | 16 +++++++--------- 9 files changed, 36 insertions(+), 69 deletions(-) diff --git a/src/java.base/share/classes/java/security/Key.java b/src/java.base/share/classes/java/security/Key.java index ce61707dcdcb5..190a3db299978 100644 --- a/src/java.base/share/classes/java/security/Key.java +++ b/src/java.base/share/classes/java/security/Key.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -121,8 +121,9 @@ public interface Key extends java.io.Serializable { /** * Returns the standard algorithm name for this key. For * example, "DSA" would indicate that this key is a DSA key. - * See the Key Algorithms section in the - * + * See the key related sections (KeyFactory, KeyGenerator, + * KeyPairGenerator, and SecretKeyFactory) in the * Java Security Standard Algorithm Names Specification * for information about standard key algorithm names. * diff --git a/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java b/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java index 104a8f21ec488..8bb23d08df35b 100644 --- a/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java +++ b/src/java.base/share/classes/java/security/spec/EncodedKeySpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -74,11 +74,11 @@ public EncodedKeySpec(byte[] encodedKey) { * * @param encodedKey the encoded key. The contents of the * array are copied to protect against subsequent modification. - * @param algorithm the algorithm name of the encoded key. - * See the AsymmetricKey Algorithms section in the - * + * @param algorithm the algorithm name of the encoded key + * See the KeyFactory section in the * Java Security Standard Algorithm Names Specification - * for information about standard asymmetric key algorithm names. + * for information about standard algorithm names. * @throws NullPointerException if {@code encodedKey} * or {@code algorithm} is null. * @throws IllegalArgumentException if {@code algorithm} is diff --git a/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java b/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java index dd14d914e254d..73d79a413216b 100644 --- a/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java +++ b/src/java.base/share/classes/java/security/spec/PKCS8EncodedKeySpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -83,11 +83,11 @@ public PKCS8EncodedKeySpec(byte[] encodedKey) { * @param encodedKey the key, which is assumed to be * encoded according to the PKCS #8 standard. The contents of * the array are copied to protect against subsequent modification. - * @param algorithm the algorithm name of the encoded private key. - * See the AsymmetricKey Algorithms section in the - * + * @param algorithm the algorithm name of the encoded private key + * See the KeyFactory section in the * Java Security Standard Algorithm Names Specification - * for information about standard asymmetric key algorithm names. + * for information about standard algorithm names. * @throws NullPointerException if {@code encodedKey} * or {@code algorithm} is null. * @throws IllegalArgumentException if {@code algorithm} is diff --git a/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java b/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java index 89748a1d228cc..7de4a2a14179a 100644 --- a/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java +++ b/src/java.base/share/classes/java/security/spec/X509EncodedKeySpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -74,10 +74,10 @@ public X509EncodedKeySpec(byte[] encodedKey) { * encoded according to the X.509 standard. The contents of the * array are copied to protect against subsequent modification. * @param algorithm the algorithm name of the encoded public key - * See the AsymmetricKey Algorithms section in the - * + * See the KeyFactory section in the * Java Security Standard Algorithm Names Specification - * for information about standard asymmetric key algorithm names. + * for information about standard algorithm names. * @throws NullPointerException if {@code encodedKey} * or {@code algorithm} is null. * @throws IllegalArgumentException if {@code algorithm} is diff --git a/src/java.base/share/classes/javax/crypto/KDF.java b/src/java.base/share/classes/javax/crypto/KDF.java index 446d3757e9a8b..0ee0904c1c2c4 100644 --- a/src/java.base/share/classes/javax/crypto/KDF.java +++ b/src/java.base/share/classes/javax/crypto/KDF.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -477,11 +477,7 @@ private static KDF handleException(NoSuchAlgorithmException e) * Derives a key, returned as a {@code SecretKey} object. * * @param alg - * the algorithm of the resultant {@code SecretKey} object. - * See the SecretKey Algorithms section in the - * - * Java Security Standard Algorithm Names Specification - * for information about standard secret key algorithm names. + * the algorithm of the resultant {@code SecretKey} object * @param derivationSpec * the object describing the inputs to the derivation function * diff --git a/src/java.base/share/classes/javax/crypto/KDFSpi.java b/src/java.base/share/classes/javax/crypto/KDFSpi.java index de021e87b7a25..dcd2029c0c06f 100644 --- a/src/java.base/share/classes/javax/crypto/KDFSpi.java +++ b/src/java.base/share/classes/javax/crypto/KDFSpi.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -115,11 +115,7 @@ protected KDFSpi(KDFParameters kdfParameters) * result of {@code deriveData}. * * @param alg - * the algorithm of the resultant {@code SecretKey} object. - * See the SecretKey Algorithms section in the - * - * Java Security Standard Algorithm Names Specification - * for information about standard secret key algorithm names. + * the algorithm of the resultant {@code SecretKey} object * @param derivationSpec * derivation parameters * @@ -158,4 +154,4 @@ protected abstract byte[] engineDeriveData( AlgorithmParameterSpec derivationSpec) throws InvalidAlgorithmParameterException; -} +} \ No newline at end of file diff --git a/src/java.base/share/classes/javax/crypto/KEM.java b/src/java.base/share/classes/javax/crypto/KEM.java index f8d9beca72938..3cb053c194c48 100644 --- a/src/java.base/share/classes/javax/crypto/KEM.java +++ b/src/java.base/share/classes/javax/crypto/KEM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -222,13 +222,7 @@ public Encapsulated encapsulate() { * to be returned, inclusive * @param to the final index of the shared secret byte array * to be returned, exclusive - * @param algorithm the algorithm name for the secret key that is returned. - * See the SecretKey Algorithms section in the - * - * Java Security Standard Algorithm Names Specification - * for information about standard secret key algorithm names. - * Use "Generic" if the output will be used as the input keying - * material of a key derivation function (KDF). + * @param algorithm the algorithm name for the secret key that is returned * @return a {@link Encapsulated} object containing a portion of * the shared secret, key encapsulation message, and optional * parameters. The portion of the shared secret is a @@ -351,13 +345,7 @@ public SecretKey decapsulate(byte[] encapsulation) throws DecapsulateException { * to be returned, inclusive * @param to the final index of the shared secret byte array * to be returned, exclusive - * @param algorithm the algorithm name for the secret key that is returned. - * See the SecretKey Algorithms section in the - * - * Java Security Standard Algorithm Names Specification - * for information about standard secret key algorithm names. - * Use "Generic" if the output will be used as the input keying - * material of a key derivation function (KDF). + * @param algorithm the algorithm name for the secret key that is returned * @return a portion of the shared secret as a {@code SecretKey} * containing the bytes of the secret ranging from {@code from} * to {@code to}, exclusive, and an algorithm name as specified. diff --git a/src/java.base/share/classes/javax/crypto/KEMSpi.java b/src/java.base/share/classes/javax/crypto/KEMSpi.java index 3c033520394af..61d13aeb02417 100644 --- a/src/java.base/share/classes/javax/crypto/KEMSpi.java +++ b/src/java.base/share/classes/javax/crypto/KEMSpi.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -129,13 +129,7 @@ interface EncapsulatorSpi { * to be returned, inclusive * @param to the final index of the shared secret byte array * to be returned, exclusive - * @param algorithm the algorithm name for the secret key that is returned. - * See the SecretKey Algorithms section in the - * - * Java Security Standard Algorithm Names Specification - * for information about standard secret key algorithm names. - * Use "Generic" if the output will be used as the input keying - * material of a key derivation function (KDF). + * @param algorithm the algorithm name for the secret key that is returned * @return an {@link KEM.Encapsulated} object containing a portion of * the shared secret as a key with the specified algorithm, * key encapsulation message, and optional parameters. @@ -194,13 +188,7 @@ interface DecapsulatorSpi { * to be returned, inclusive * @param to the final index of the shared secret byte array * to be returned, exclusive - * @param algorithm the algorithm name for the secret key that is returned. - * See the SecretKey Algorithms section in the - * - * Java Security Standard Algorithm Names Specification - * for information about standard secret key algorithm names. - * Use "Generic" if the output will be used as the input keying - * material of a key derivation function (KDF). + * @param algorithm the algorithm name for the secret key that is returned * @return a portion of the shared secret as a {@code SecretKey} with * the specified algorithm * @throws DecapsulateException if an error occurs during the diff --git a/src/java.base/share/classes/javax/crypto/spec/SecretKeySpec.java b/src/java.base/share/classes/javax/crypto/spec/SecretKeySpec.java index be185cb34ad11..d36510a21a82f 100644 --- a/src/java.base/share/classes/javax/crypto/spec/SecretKeySpec.java +++ b/src/java.base/share/classes/javax/crypto/spec/SecretKeySpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -93,10 +93,9 @@ public class SecretKeySpec implements KeySpec, SecretKey { * the array are copied to protect against subsequent modification. * @param algorithm the name of the secret-key algorithm to be associated * with the given key material. - * See the SecretKey Algorithms section in the - * - * Java Security Standard Algorithm Names Specification - * for information about standard secret key algorithm names. + * See the + * Java Security Standard Algorithm Names document + * for information about standard algorithm names. * @exception IllegalArgumentException if algorithm * is null or key is null or empty. * @@ -138,10 +137,9 @@ public SecretKeySpec(byte[] key, String algorithm) { * @param len the length of the key material. * @param algorithm the name of the secret-key algorithm to be associated * with the given key material. - * See the SecretKey Algorithms section in the - * - * Java Security Standard Algorithm Names Specification - * for information about standard secret key algorithm names. + * See the + * Java Security Standard Algorithm Names document + * for information about standard algorithm names. * @exception IllegalArgumentException if algorithm * is null or key is null, empty, or too short, * i.e. {@code key.length-offset