8346736: Java Security Standard Algorithm Names spec should include key algorithm names

Reviewed-by: mullan, hchao
This commit is contained in:
Weijun Wang 2025-01-27 18:21:51 +00:00
parent aba60a9274
commit 039e73fcdb
9 changed files with 75 additions and 33 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2025, 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
@ -120,10 +120,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 related sections (KeyFactory, KeyGenerator,
* KeyPairGenerator, and SecretKeyFactory) in the <a href=
* "{@docRoot}/../specs/security/standard-names.html">
* example, "RSA" would indicate that this key is an RSA key.
* See the Key Algorithms section in the
* <a href="{@docRoot}/../specs/security/standard-names.html#key-algorithms">
* Java Security Standard Algorithm Names Specification</a>
* for information about standard key algorithm names.
*

View file

@ -74,16 +74,17 @@ public abstract class EncodedKeySpec implements KeySpec {
*
* @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 KeyFactory section in the <a href=
* "{@docRoot}/../specs/security/standard-names.html#keyfactory-algorithms">
* @param algorithm the algorithm name of the encoded key.
* See the AsymmetricKey Algorithms section in the
* <a href="{@docRoot}/../specs/security/standard-names.html#asymmetrickey-algorithms">
* Java Security Standard Algorithm Names Specification</a>
* for information about standard algorithm names.
* for information about standard asymmetric key algorithm names.
* @spec security/standard-names.html Java Security Standard Algorithm Names
* @throws NullPointerException if {@code encodedKey}
* or {@code algorithm} is null.
* @throws IllegalArgumentException if {@code algorithm} is
* the empty string {@code ""}
* @spec security/standard-names.html Java Security Standard Algorithm Names
* @since 9
*/
protected EncodedKeySpec(byte[] encodedKey, String algorithm) {

View file

@ -83,16 +83,17 @@ public class PKCS8EncodedKeySpec extends EncodedKeySpec {
* @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 KeyFactory section in the <a href=
* "{@docRoot}/../specs/security/standard-names.html#keyfactory-algorithms">
* @param algorithm the algorithm name of the encoded private key.
* See the AsymmetricKey Algorithms section in the
* <a href="{@docRoot}/../specs/security/standard-names.html#asymmetrickey-algorithms">
* Java Security Standard Algorithm Names Specification</a>
* for information about standard algorithm names.
* for information about standard asymmetric key algorithm names.
* @spec security/standard-names.html Java Security Standard Algorithm Names
* @throws NullPointerException if {@code encodedKey}
* or {@code algorithm} is null.
* @throws IllegalArgumentException if {@code algorithm} is
* the empty string {@code ""}
* @spec security/standard-names.html Java Security Standard Algorithm Names
* @since 9
*/
public PKCS8EncodedKeySpec(byte[] encodedKey, String algorithm) {

View file

@ -73,16 +73,17 @@ public class X509EncodedKeySpec extends EncodedKeySpec {
* @param encodedKey the key, which is assumed to be
* 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 KeyFactory section in the <a href=
* "{@docRoot}/../specs/security/standard-names.html#keyfactory-algorithms">
* @param algorithm the algorithm name of the encoded public key.
* See the AsymmetricKey Algorithms section in the
* <a href="{@docRoot}/../specs/security/standard-names.html#asymmetrickey-algorithms">
* Java Security Standard Algorithm Names Specification</a>
* for information about standard algorithm names.
* for information about standard asymmetric key algorithm names.
* @spec security/standard-names.html Java Security Standard Algorithm Names
* @throws NullPointerException if {@code encodedKey}
* or {@code algorithm} is null.
* @throws IllegalArgumentException if {@code algorithm} is
* the empty string {@code ""}
* @spec security/standard-names.html Java Security Standard Algorithm Names
* @since 9
*/
public X509EncodedKeySpec(byte[] encodedKey, String algorithm) {