author | naoto |
Tue, 15 Oct 2019 09:25:59 -0700 | |
changeset 58603 | 2312d1a04c49 |
parent 57655 | a95e92c449bf |
permissions | -rw-r--r-- |
50053 | 1 |
/* |
57655
a95e92c449bf
8210755: Define standard names for EC curves and TLS signature schemes
mullan
parents:
50053
diff
changeset
|
2 |
* Copyright (c) 2018, 2019 Oracle and/or its affiliates. All rights reserved. |
50053 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
package java.security.spec; |
|
26 |
||
27 |
import java.util.Objects; |
|
28 |
||
29 |
/** |
|
30 |
* This class is used to specify any algorithm parameters that are determined |
|
31 |
* by a standard name. This class also holds constants for standard parameter |
|
32 |
* set names. The names of these constants exactly match the corresponding |
|
33 |
* parameter set name. For example, NamedParameterSpec.X25519 represents the |
|
34 |
* parameter set identified by the string "X25519". These strings are defined |
|
35 |
* in the <a href= |
|
57655
a95e92c449bf
8210755: Define standard names for EC curves and TLS signature schemes
mullan
parents:
50053
diff
changeset
|
36 |
* "{@docRoot}/../specs/security/standard-names.html#parameterspec-names"> |
50053 | 37 |
* Java Security Standard Algorithm Names Specification</a>. |
38 |
* |
|
39 |
* @since 11 |
|
40 |
* |
|
41 |
*/ |
|
42 |
public class NamedParameterSpec implements AlgorithmParameterSpec { |
|
43 |
||
44 |
/** |
|
45 |
* The X25519 parameters |
|
46 |
*/ |
|
47 |
public static final NamedParameterSpec X25519 |
|
48 |
= new NamedParameterSpec("X25519"); |
|
49 |
/** |
|
50 |
* The X448 parameters |
|
51 |
*/ |
|
52 |
public static final NamedParameterSpec X448 |
|
53 |
= new NamedParameterSpec("X448"); |
|
54 |
||
55 |
private String name; |
|
56 |
||
57 |
/** |
|
58 |
* Creates a parameter specification using a standard (or predefined) |
|
59 |
* name {@code stdName}. For the |
|
60 |
* list of supported names, please consult the documentation |
|
61 |
* of the provider whose implementation will be used. |
|
62 |
* |
|
57655
a95e92c449bf
8210755: Define standard names for EC curves and TLS signature schemes
mullan
parents:
50053
diff
changeset
|
63 |
* @param stdName the standard name of the algorithm parameters. See the |
a95e92c449bf
8210755: Define standard names for EC curves and TLS signature schemes
mullan
parents:
50053
diff
changeset
|
64 |
* ParameterSpec Names section in the |
a95e92c449bf
8210755: Define standard names for EC curves and TLS signature schemes
mullan
parents:
50053
diff
changeset
|
65 |
* <a href= |
a95e92c449bf
8210755: Define standard names for EC curves and TLS signature schemes
mullan
parents:
50053
diff
changeset
|
66 |
* "{@docRoot}/../specs/security/standard-names.html#parameterspec-names"> |
a95e92c449bf
8210755: Define standard names for EC curves and TLS signature schemes
mullan
parents:
50053
diff
changeset
|
67 |
* Java Security Standard Algorithm Names Specification</a> for |
a95e92c449bf
8210755: Define standard names for EC curves and TLS signature schemes
mullan
parents:
50053
diff
changeset
|
68 |
* information about standard names. |
50053 | 69 |
* |
57655
a95e92c449bf
8210755: Define standard names for EC curves and TLS signature schemes
mullan
parents:
50053
diff
changeset
|
70 |
* @throws NullPointerException if {@code stdName} is null. |
50053 | 71 |
*/ |
72 |
public NamedParameterSpec(String stdName) { |
|
73 |
Objects.requireNonNull(stdName, "stdName must not be null"); |
|
74 |
||
75 |
this.name = stdName; |
|
76 |
} |
|
77 |
||
78 |
/** |
|
79 |
* Returns the standard name that determines the algorithm parameters. |
|
80 |
* @return the standard name. |
|
81 |
*/ |
|
82 |
public String getName() { |
|
83 |
return name; |
|
84 |
} |
|
85 |
} |