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
114 */
115 protected KeyInfoFactory() {}
116
117 /**
118 * Returns a <code>KeyInfoFactory</code> that supports the
119 * specified XML processing mechanism and representation type (ex: "DOM").
120 *
121 * <p>This method uses the standard JCA provider lookup mechanism to
122 * locate and instantiate a <code>KeyInfoFactory</code> implementation of
123 * the desired mechanism type. It traverses the list of registered security
124 * <code>Provider</code>s, starting with the most preferred
125 * <code>Provider</code>. A new <code>KeyInfoFactory</code> object
126 * from the first <code>Provider</code> that supports the specified
127 * mechanism is returned.
128 *
129 * <p> Note that the list of registered providers may be retrieved via
130 * the {@link Security#getProviders() Security.getProviders()} method.
131 *
132 * @implNote
133 * The JDK Reference Implementation additionally uses the
134 * {@code jdk.security.provider.preferred} property to determine
135 * the preferred provider order for the specified algorithm. This
136 * may be different than the order of providers returned by
137 * {@link Security#getProviders() Security.getProviders()}.
138 *
139 * @param mechanismType the type of the XML processing mechanism and
140 * representation. See the <a
141 * href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
142 * Service Providers</a> section of the API overview for a list of
143 * standard mechanism types.
144 * @return a new <code>KeyInfoFactory</code>
145 * @throws NullPointerException if <code>mechanismType</code> is
146 * <code>null</code>
147 * @throws NoSuchMechanismException if no <code>Provider</code> supports a
148 * <code>KeyInfoFactory</code> implementation for the specified mechanism
149 * @see Provider
150 */
151 public static KeyInfoFactory getInstance(String mechanismType) {
152 if (mechanismType == null) {
153 throw new NullPointerException("mechanismType cannot be null");
154 }
255 return factory;
256 }
257
258 /**
259 * Returns a <code>KeyInfoFactory</code> that supports the
260 * default XML processing mechanism and representation type ("DOM").
261 *
262 * <p>This method uses the standard JCA provider lookup mechanism to
263 * locate and instantiate a <code>KeyInfoFactory</code> implementation of
264 * the default mechanism type. It traverses the list of registered security
265 * <code>Provider</code>s, starting with the most preferred
266 * <code>Provider</code>. A new <code>KeyInfoFactory</code> object
267 * from the first <code>Provider</code> that supports the DOM mechanism is
268 * returned.
269 *
270 * <p> Note that the list of registered providers may be retrieved via
271 * the {@link Security#getProviders() Security.getProviders()} method.
272 *
273 * @implNote
274 * The JDK Reference Implementation additionally uses the
275 * {@code jdk.security.provider.preferred} property to determine
276 * the preferred provider order for the specified algorithm. This
277 * may be different than the order of providers returned by
278 * {@link Security#getProviders() Security.getProviders()}.
279 *
280 * @return a new <code>KeyInfoFactory</code>
281 * @throws NoSuchMechanismException if no <code>Provider</code> supports a
282 * <code>KeyInfoFactory</code> implementation for the DOM mechanism
283 * @see Provider
284 */
285 public static KeyInfoFactory getInstance() {
286 return getInstance("DOM");
287 }
288
289 /**
290 * Returns the type of the XML processing mechanism and representation
291 * supported by this <code>KeyInfoFactory</code> (ex: "DOM")
292 *
293 * @return the XML processing mechanism type supported by this
294 * <code>KeyInfoFactory</code>
295 */
|
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
114 */
115 protected KeyInfoFactory() {}
116
117 /**
118 * Returns a <code>KeyInfoFactory</code> that supports the
119 * specified XML processing mechanism and representation type (ex: "DOM").
120 *
121 * <p>This method uses the standard JCA provider lookup mechanism to
122 * locate and instantiate a <code>KeyInfoFactory</code> implementation of
123 * the desired mechanism type. It traverses the list of registered security
124 * <code>Provider</code>s, starting with the most preferred
125 * <code>Provider</code>. A new <code>KeyInfoFactory</code> object
126 * from the first <code>Provider</code> that supports the specified
127 * mechanism is returned.
128 *
129 * <p> Note that the list of registered providers may be retrieved via
130 * the {@link Security#getProviders() Security.getProviders()} method.
131 *
132 * @implNote
133 * The JDK Reference Implementation additionally uses the
134 * {@code jdk.security.provider.preferred}
135 * {@link Security#getProperty(String) Security} property to determine
136 * the preferred provider order for the specified algorithm. This
137 * may be different than the order of providers returned by
138 * {@link Security#getProviders() Security.getProviders()}.
139 *
140 * @param mechanismType the type of the XML processing mechanism and
141 * representation. See the <a
142 * href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider">
143 * Service Providers</a> section of the API overview for a list of
144 * standard mechanism types.
145 * @return a new <code>KeyInfoFactory</code>
146 * @throws NullPointerException if <code>mechanismType</code> is
147 * <code>null</code>
148 * @throws NoSuchMechanismException if no <code>Provider</code> supports a
149 * <code>KeyInfoFactory</code> implementation for the specified mechanism
150 * @see Provider
151 */
152 public static KeyInfoFactory getInstance(String mechanismType) {
153 if (mechanismType == null) {
154 throw new NullPointerException("mechanismType cannot be null");
155 }
256 return factory;
257 }
258
259 /**
260 * Returns a <code>KeyInfoFactory</code> that supports the
261 * default XML processing mechanism and representation type ("DOM").
262 *
263 * <p>This method uses the standard JCA provider lookup mechanism to
264 * locate and instantiate a <code>KeyInfoFactory</code> implementation of
265 * the default mechanism type. It traverses the list of registered security
266 * <code>Provider</code>s, starting with the most preferred
267 * <code>Provider</code>. A new <code>KeyInfoFactory</code> object
268 * from the first <code>Provider</code> that supports the DOM mechanism is
269 * returned.
270 *
271 * <p> Note that the list of registered providers may be retrieved via
272 * the {@link Security#getProviders() Security.getProviders()} method.
273 *
274 * @implNote
275 * The JDK Reference Implementation additionally uses the
276 * {@code jdk.security.provider.preferred}
277 * {@link Security#getProperty(String) Security} property to determine
278 * the preferred provider order for the specified algorithm. This
279 * may be different than the order of providers returned by
280 * {@link Security#getProviders() Security.getProviders()}.
281 *
282 * @return a new <code>KeyInfoFactory</code>
283 * @throws NoSuchMechanismException if no <code>Provider</code> supports a
284 * <code>KeyInfoFactory</code> implementation for the DOM mechanism
285 * @see Provider
286 */
287 public static KeyInfoFactory getInstance() {
288 return getInstance("DOM");
289 }
290
291 /**
292 * Returns the type of the XML processing mechanism and representation
293 * supported by this <code>KeyInfoFactory</code> (ex: "DOM")
294 *
295 * @return the XML processing mechanism type supported by this
296 * <code>KeyInfoFactory</code>
297 */
|