Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureMethod.java
41161 views
1
/*
2
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
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
/*
26
* $Id: SignatureMethod.java,v 1.5 2005/05/10 16:03:46 mullan Exp $
27
*/
28
package javax.xml.crypto.dsig;
29
30
import javax.xml.crypto.AlgorithmMethod;
31
import javax.xml.crypto.XMLStructure;
32
import javax.xml.crypto.dsig.spec.SignatureMethodParameterSpec;
33
import java.security.spec.AlgorithmParameterSpec;
34
35
/**
36
* A representation of the XML <code>SignatureMethod</code> element
37
* as defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
38
* W3C Recommendation for XML-Signature Syntax and Processing</a>.
39
* The XML Schema Definition is defined as:
40
* <pre>
41
* &lt;element name="SignatureMethod" type="ds:SignatureMethodType"/&gt;
42
* &lt;complexType name="SignatureMethodType" mixed="true"&gt;
43
* &lt;sequence&gt;
44
* &lt;element name="HMACOutputLength" minOccurs="0" type="ds:HMACOutputLengthType"/&gt;
45
* &lt;any namespace="##any" minOccurs="0" maxOccurs="unbounded"/&gt;
46
* &lt;!-- (0,unbounded) elements from (1,1) namespace --&gt;
47
* &lt;/sequence&gt;
48
* &lt;attribute name="Algorithm" type="anyURI" use="required"/&gt;
49
* &lt;/complexType&gt;
50
* </pre>
51
*
52
* A <code>SignatureMethod</code> instance may be created by invoking the
53
* {@link XMLSignatureFactory#newSignatureMethod newSignatureMethod} method
54
* of the {@link XMLSignatureFactory} class.
55
*
56
* @author Sean Mullan
57
* @author JSR 105 Expert Group
58
* @since 1.6
59
* @see XMLSignatureFactory#newSignatureMethod(String, SignatureMethodParameterSpec)
60
*/
61
public interface SignatureMethod extends XMLStructure, AlgorithmMethod {
62
63
// All methods can be found in RFC 6931.
64
65
/**
66
* The <a href="http://www.w3.org/2000/09/xmldsig#dsa-sha1">DSA-SHA1</a>
67
* (DSS) signature method algorithm URI.
68
*/
69
String DSA_SHA1 =
70
"http://www.w3.org/2000/09/xmldsig#dsa-sha1";
71
72
/**
73
* The <a href="http://www.w3.org/2009/xmldsig11#dsa-sha256">DSA-SHA256</a>
74
* (DSS) signature method algorithm URI.
75
*
76
* @since 11
77
*/
78
String DSA_SHA256 = "http://www.w3.org/2009/xmldsig11#dsa-sha256";
79
80
/**
81
* The <a href="http://www.w3.org/2000/09/xmldsig#rsa-sha1">RSA-SHA1</a>
82
* (PKCS #1) signature method algorithm URI.
83
*/
84
String RSA_SHA1 =
85
"http://www.w3.org/2000/09/xmldsig#rsa-sha1";
86
87
/**
88
* The <a href="http://www.w3.org/2001/04/xmldsig-more#rsa-sha224">
89
* RSA-SHA224</a> (PKCS #1) signature method algorithm URI.
90
*
91
* @since 11
92
*/
93
String RSA_SHA224 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha224";
94
95
/**
96
* The <a href="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256">
97
* RSA-SHA256</a> (PKCS #1) signature method algorithm URI.
98
*
99
* @since 11
100
*/
101
String RSA_SHA256 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";
102
103
/**
104
* The <a href="http://www.w3.org/2001/04/xmldsig-more#rsa-sha384">
105
* RSA-SHA384</a> (PKCS #1) signature method algorithm URI.
106
*
107
* @since 11
108
*/
109
String RSA_SHA384 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384";
110
111
/**
112
* The <a href="http://www.w3.org/2001/04/xmldsig-more#rsa-sha512">
113
* RSA-SHA512</a> (PKCS #1) signature method algorithm URI.
114
*
115
* @since 11
116
*/
117
String RSA_SHA512 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512";
118
119
/**
120
* The <a href="http://www.w3.org/2007/05/xmldsig-more#sha1-rsa-MGF1">
121
* SHA1-RSA-MGF1</a> (PKCS #1) signature method algorithm URI.
122
*
123
* @since 11
124
*/
125
String SHA1_RSA_MGF1 = "http://www.w3.org/2007/05/xmldsig-more#sha1-rsa-MGF1";
126
127
/**
128
* The <a href="http://www.w3.org/2007/05/xmldsig-more#sha224-rsa-MGF1">
129
* SHA224-RSA-MGF1</a> (PKCS #1) signature method algorithm URI.
130
*
131
* @since 11
132
*/
133
String SHA224_RSA_MGF1 = "http://www.w3.org/2007/05/xmldsig-more#sha224-rsa-MGF1";
134
135
/**
136
* The <a href="http://www.w3.org/2007/05/xmldsig-more#sha256-rsa-MGF1">
137
* SHA256-RSA-MGF1</a> (PKCS #1) signature method algorithm URI.
138
*
139
* @since 11
140
*/
141
String SHA256_RSA_MGF1 = "http://www.w3.org/2007/05/xmldsig-more#sha256-rsa-MGF1";
142
143
/**
144
* The <a href="http://www.w3.org/2007/05/xmldsig-more#sha384-rsa-MGF1">
145
* SHA384-RSA-MGF1</a> (PKCS #1) signature method algorithm URI.
146
*
147
* @since 11
148
*/
149
String SHA384_RSA_MGF1 = "http://www.w3.org/2007/05/xmldsig-more#sha384-rsa-MGF1";
150
151
/**
152
* The <a href="http://www.w3.org/2007/05/xmldsig-more#sha512-rsa-MGF1">
153
* SHA512-RSA-MGF1</a> (PKCS #1) signature method algorithm URI.
154
*
155
* @since 11
156
*/
157
String SHA512_RSA_MGF1 = "http://www.w3.org/2007/05/xmldsig-more#sha512-rsa-MGF1";
158
159
/**
160
* The <a href="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1">
161
* ECDSA-SHA1</a> (FIPS 180-4) signature method algorithm URI.
162
*
163
* @since 11
164
*/
165
String ECDSA_SHA1 = "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1";
166
167
/**
168
* The <a href="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha224">
169
* ECDSA-SHA224</a> (FIPS 180-4) signature method algorithm URI.
170
*
171
* @since 11
172
*/
173
String ECDSA_SHA224 = "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha224";
174
175
/**
176
* The <a href="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256">
177
* ECDSA-SHA256</a> (FIPS 180-4) signature method algorithm URI.
178
*
179
* @since 11
180
*/
181
String ECDSA_SHA256 = "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256";
182
183
/**
184
* The <a href="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha384">
185
* ECDSA-SHA384</a> (FIPS 180-4) signature method algorithm URI.
186
*
187
* @since 11
188
*/
189
String ECDSA_SHA384 = "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha384";
190
191
/**
192
* The <a href="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha512">
193
* ECDSA-SHA512</a> (FIPS 180-4) signature method algorithm URI.
194
*
195
* @since 11
196
*/
197
String ECDSA_SHA512 = "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha512";
198
199
/**
200
* The <a href="http://www.w3.org/2000/09/xmldsig#hmac-sha1">HMAC-SHA1</a>
201
* MAC signature method algorithm URI
202
*/
203
String HMAC_SHA1 =
204
"http://www.w3.org/2000/09/xmldsig#hmac-sha1";
205
206
/**
207
* The <a href="http://www.w3.org/2001/04/xmldsig-more#hmac-sha224">
208
* HMAC-SHA224</a> MAC signature method algorithm URI.
209
*
210
* @since 11
211
*/
212
String HMAC_SHA224 = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha224";
213
214
/**
215
* The <a href="http://www.w3.org/2001/04/xmldsig-more#hmac-sha256">
216
* HMAC-SHA256</a> MAC signature method algorithm URI.
217
*
218
* @since 11
219
*/
220
String HMAC_SHA256 = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256";
221
222
/**
223
* The <a href="http://www.w3.org/2001/04/xmldsig-more#hmac-sha384">
224
* HMAC-SHA384</a> MAC signature method algorithm URI.
225
*
226
* @since 11
227
*/
228
String HMAC_SHA384 = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha384";
229
230
/**
231
* The <a href="http://www.w3.org/2001/04/xmldsig-more#hmac-sha512">
232
* HMAC-SHA512</a> MAC signature method algorithm URI.
233
*
234
* @since 11
235
*/
236
String HMAC_SHA512 = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha512";
237
238
239
/**
240
* The <a href="http://www.w3.org/2007/05/xmldsig-more#rsa-pss">
241
* RSASSA-PSS</a> signature method algorithm URI.
242
* <p>
243
* Calling {@link XMLSignatureFactory#newSignatureMethod
244
* XMLSignatureFactory.newSignatureMethod(RSA_PSS, null)} returns a
245
* {@code SignatureMethod} object that uses the default parameter as defined in
246
* <a href="https://tools.ietf.org/html/rfc6931#section-2.3.9">RFC 6931 Section 2.3.9</a>,
247
* which uses SHA-256 as the {@code DigestMethod}, MGF1 with SHA-256 as the
248
* {@code MaskGenerationFunction}, 32 as {@code SaltLength}, and 1 as
249
* {@code TrailerField}. This default parameter is represented as an
250
* {@link javax.xml.crypto.dsig.spec.RSAPSSParameterSpec RSAPSSParameterSpec}
251
* type and returned by the {@link #getParameterSpec()} method
252
* of the {@code SignatureMethod} object.
253
*
254
* @since 17
255
*/
256
String RSA_PSS = "http://www.w3.org/2007/05/xmldsig-more#rsa-pss";
257
258
/**
259
* Returns the algorithm-specific input parameters of this
260
* <code>SignatureMethod</code>.
261
*
262
* <p>The returned parameters can be typecast to a {@link
263
* SignatureMethodParameterSpec} object.
264
*
265
* @return the algorithm-specific input parameters of this
266
* <code>SignatureMethod</code> (may be <code>null</code> if not
267
* specified)
268
*/
269
AlgorithmParameterSpec getParameterSpec();
270
}
271
272