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/package-info.java
41161 views
1
/*
2
* Copyright (c) 2005, 2018, 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
/**
27
* Classes for generating and validating XML digital
28
* signatures. This package includes classes that represent the core elements
29
* defined in the W3C XML digital signature specification:
30
* {@link javax.xml.crypto.dsig.XMLSignature XMLSignature},
31
* {@link javax.xml.crypto.dsig.SignedInfo SignedInfo},
32
* {@link javax.xml.crypto.dsig.CanonicalizationMethod CanonicalizationMethod},
33
* {@link javax.xml.crypto.dsig.SignatureMethod SignatureMethod},
34
* {@link javax.xml.crypto.dsig.Reference Reference},
35
* {@link javax.xml.crypto.dsig.DigestMethod DigestMethod},
36
* {@link javax.xml.crypto.dsig.XMLObject XMLObject},
37
* {@link javax.xml.crypto.dsig.Manifest Manifest},
38
* {@link javax.xml.crypto.dsig.SignatureProperties SignatureProperties}, and
39
* {@link javax.xml.crypto.dsig.SignatureProperty SignatureProperty}.
40
* {@code KeyInfo} types are defined in the
41
* {@link javax.xml.crypto.dsig.keyinfo} subpackage.
42
* {@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory}
43
* is an abstract factory that creates
44
* {@link javax.xml.crypto.dsig.XMLSignature XMLSignature} objects from scratch
45
* or from a pre-existing XML representation, such as a DOM node.
46
* {@link javax.xml.crypto.dsig.TransformService} is a service provider
47
* interface for creating and plugging in implementations of
48
* transform and canonicalization algorithms.
49
*
50
* <p>Of primary significance in this package is the
51
* {@link javax.xml.crypto.dsig.XMLSignature XMLSignature} class,
52
* which allows you to sign and validate an XML digital signature.
53
*
54
* <h2><a id="service_providers"></a>Service Providers</h2>
55
* A service provider is a concrete implementation of the abstract
56
* {@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} and
57
* {@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory KeyInfoFactory} classes
58
* and is responsible for creating objects and algorithms that parse, generate
59
* and validate XML Signatures and KeyInfo structures. A concrete implementation
60
* of {@code XMLSignatureFactory} MUST provide support for each of the REQUIRED
61
* algorithms as specified by the W3C recommendation for XML Signatures. It MAY
62
* support other algorithms as defined by the W3C recommendation or other
63
* specifications.
64
*
65
* <p>The API leverages the JCA provider model (see
66
* {@link java.security.Provider the Provider class}) for registering and
67
* loading {@code XMLSignatureFactory} and {@code KeyInfoFactory}
68
* implementations.
69
*
70
* <p>Each concrete {@code XMLSignatureFactory} or {@code KeyInfoFactory}
71
* implementation supports a specific XML mechanism type that identifies the XML
72
* processing mechanism that an implementation uses internally to parse and
73
* generate XML signature and KeyInfo structures.
74
*
75
* <p>A service provider implementation SHOULD use underlying JCA engine
76
* classes, such as {@link java.security.Signature} and
77
* {@link java.security.MessageDigest} to perform cryptographic operations.
78
*
79
* <p>In addition to the {@code XMLSignatureFactory} and {@code KeyInfoFactory}
80
* classes, the API supports a service provider interface for transform and
81
* canonicalization algorithms. The {@link
82
* javax.xml.crypto.dsig.TransformService TransformService} class allows you to
83
* develop and plug in an implementation of a specific transform or
84
* canonicalization algorithm for a particular XML mechanism type. The {@code
85
* TransformService} class uses the standard JCA provider model for registering
86
* and loading implementations. Each service provider implementation SHOULD use
87
* the {@code TransformService} class to find a provider that supports transform
88
* and canonicalization algorithms in XML Signatures that it is generating or
89
* validating.
90
*
91
* <h3><a id="dom_req"></a>DOM Mechanism Requirements</h3>
92
* The following requirements MUST be abided by when implementing a DOM-based
93
* {@code XMLSignatureFactory}, {@code KeyInfoFactory} or {@code
94
* TransformService} in order to minimize interoperability problems:
95
* <ol>
96
* <li>The {@code unmarshalXMLSignature} method of {@code XMLSignatureFactory}
97
* MUST support {@code DOMValidateContext} types. If the type is
98
* {@code DOMValidateContext}, it SHOULD contain an {@code Element} of type
99
* Signature. Additionally, the {@code unmarshalXMLSignature} method MAY
100
* populate the Id/Element mappings of the passed-in {@code DOMValidateContext}.
101
* </li>
102
*
103
* <li>The {@code sign} method of {@code XMLSignature}s produced by
104
* {@code XMLSignatureFactory} MUST support {@code DOMSignContext} types and the
105
* {@code validate} method MUST support {@code DOMValidateContext} types. This
106
* requirement also applies to the {@code validate} method of {@code
107
* SignatureValue} and the {@code validate} method of {@code Reference}.</li>
108
*
109
* <li>The implementation MUST support {@code DOMStructure}s as the mechanism
110
* for the application to specify extensible content (any elements or mixed
111
* content).</li>
112
*
113
* <li>If the {@code dereference} method of user-specified {@code
114
* URIDereferencer}s returns {@code NodeSetData} objects, the {@code iterator}
115
* method MUST return an iteration over objects of type {@code
116
* org.w3c.dom.Node}.</li>
117
*
118
* <li>{@code URIReference} objects passed to the {@code dereference} method of
119
* user-specified {@code URIDereferencer}s MUST be of type {@code
120
* DOMURIReference} and {@code XMLCryptoContext} objects MUST implement {@code
121
* DOMCryptoContext}.</li>
122
*
123
* <li>The previous 2 requirements also apply to {@code URIDereferencer}s
124
* returned by the {@code getURIDereferencer} method of {@code
125
* XMLSignatureFactory} and {@code KeyInfoFactory}.</li>
126
*
127
* <li>The {@code unmarshalKeyInfo} method of {@code KeyInfoFactory} MUST
128
* support {@code DOMStructure} types. If the type is {@code DOMStructure}, it
129
* SHOULD contain an {@code Element} of type {@code KeyInfo}.</li>
130
*
131
* <li>The {@code transform} method of {@code Transform} MUST support
132
* {@code DOMCryptoContext} context parameter types.</li>
133
*
134
* <li>The {@code newtransform} and {@code newCanonicalizationMethod} methods of
135
* {@code XMLSignatureFactory} MUST support {@code DOMStructure} parameter
136
* types.</li>
137
*
138
* <li>The {@code init}, and {@code marshalParams} methods of
139
* {@code TransformService} MUST support {@code DOMStructure} and
140
* {@code DOMCryptoContext} types.</li>
141
*
142
* <li>The {@code unmarshalXMLSignature} method of {@code XMLSignatureFactory}
143
* MUST support {@code DOMStructure} types. If the type is {@code DOMStructure},
144
* it SHOULD contain an {@code Element} of type {@code Signature}.</li>
145
*
146
* <li>The {@code marshal} method of {@code KeyInfo} MUST support
147
* {@code DOMStructure} and {@code DOMCryptoContext} parameter types.</li>
148
* </ol>
149
*
150
* <p>Note that a DOM implementation MAY internally use other XML parsing APIs
151
* other than DOM as long as it doesn't affect interoperability. For example, a
152
* DOM implementation of {@code XMLSignatureFactory} might use a SAX parser
153
* internally to canonicalize data.
154
*
155
* <h2>Package Specification</h2>
156
*
157
* <ul>
158
* <li>
159
* <a href="http://www.w3.org/TR/xmldsig-core/">
160
* XML-Signature Syntax and Processing: W3C Recommendation</a>
161
* <li>
162
* <a href="http://www.ietf.org/rfc/rfc3275.txt">
163
* RFC 3275: XML-Signature Syntax and Processing</a>
164
* </ul>
165
*
166
* @since 1.6
167
*/
168
169
package javax.xml.crypto.dsig;
170
171