1 /*
2 * Copyright (c) 2005, 2015, 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
158 */
159 protected XMLSignatureFactory() {}
160
161 /**
162 * Returns an <code>XMLSignatureFactory</code> that supports the
163 * specified XML processing mechanism and representation type (ex: "DOM").
164 *
165 * <p>This method uses the standard JCA provider lookup mechanism to
166 * locate and instantiate an <code>XMLSignatureFactory</code>
167 * implementation of the desired mechanism type. It traverses the list of
168 * registered security <code>Provider</code>s, starting with the most
169 * preferred <code>Provider</code>. A new <code>XMLSignatureFactory</code>
170 * object from the first <code>Provider</code> that supports the specified
171 * mechanism is returned.
172 *
173 * <p>Note that the list of registered providers may be retrieved via
174 * the {@link Security#getProviders() Security.getProviders()} method.
175 *
176 * @implNote
177 * The JDK Reference Implementation additionally uses the
178 * {@code jdk.security.provider.preferred} property to determine
179 * the preferred provider order for the specified algorithm. This
180 * may be different than the order of providers returned by
181 * {@link Security#getProviders() Security.getProviders()}.
182 *
183 * @param mechanismType the type of the XML processing mechanism and
184 * representation. See the <a
185 * href="../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
186 * Service Providers</a> section of the API overview for a list of
187 * standard mechanism types.
188 * @return a new <code>XMLSignatureFactory</code>
189 * @throws NullPointerException if <code>mechanismType</code> is
190 * <code>null</code>
191 * @throws NoSuchMechanismException if no <code>Provider</code> supports an
192 * <code>XMLSignatureFactory</code> implementation for the specified
193 * mechanism
194 * @see Provider
195 */
196 public static XMLSignatureFactory getInstance(String mechanismType) {
197 if (mechanismType == null) {
198 throw new NullPointerException("mechanismType cannot be null");
|
1 /*
2 * Copyright (c) 2005, 2016, 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
158 */
159 protected XMLSignatureFactory() {}
160
161 /**
162 * Returns an <code>XMLSignatureFactory</code> that supports the
163 * specified XML processing mechanism and representation type (ex: "DOM").
164 *
165 * <p>This method uses the standard JCA provider lookup mechanism to
166 * locate and instantiate an <code>XMLSignatureFactory</code>
167 * implementation of the desired mechanism type. It traverses the list of
168 * registered security <code>Provider</code>s, starting with the most
169 * preferred <code>Provider</code>. A new <code>XMLSignatureFactory</code>
170 * object from the first <code>Provider</code> that supports the specified
171 * mechanism is returned.
172 *
173 * <p>Note that the list of registered providers may be retrieved via
174 * the {@link Security#getProviders() Security.getProviders()} method.
175 *
176 * @implNote
177 * The JDK Reference Implementation additionally uses the
178 * {@code jdk.security.provider.preferred}
179 * {@link Security#getProperty(String) Security} property to determine
180 * the preferred provider order for the specified algorithm. This
181 * may be different than the order of providers returned by
182 * {@link Security#getProviders() Security.getProviders()}.
183 *
184 * @param mechanismType the type of the XML processing mechanism and
185 * representation. See the <a
186 * href="../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
187 * Service Providers</a> section of the API overview for a list of
188 * standard mechanism types.
189 * @return a new <code>XMLSignatureFactory</code>
190 * @throws NullPointerException if <code>mechanismType</code> is
191 * <code>null</code>
192 * @throws NoSuchMechanismException if no <code>Provider</code> supports an
193 * <code>XMLSignatureFactory</code> implementation for the specified
194 * mechanism
195 * @see Provider
196 */
197 public static XMLSignatureFactory getInstance(String mechanismType) {
198 if (mechanismType == null) {
199 throw new NullPointerException("mechanismType cannot be null");
|