/** * Returns an <code>XMLSignatureFactory</code> that supports the * requested XML processing mechanism and representation type (ex: "DOM"), * as supplied by the specified provider. Note that the specified * <code>Provider</code> object does not have to be registered in the * provider list. * * @param mechanismType the type of the XML processing mechanism and * representation. See the {@extLink security_guide_xmldsig_provider * Service Providers} section of the API overview for a list of * standard mechanism types. * @param provider the <code>Provider</code> object * @return a new <code>XMLSignatureFactory</code> * @throws NullPointerException if <code>provider</code> or * <code>mechanismType</code> is <code>null</code> * @throws NoSuchMechanismException if an <code>XMLSignatureFactory</code> * implementation for the specified mechanism is not available * from the specified <code>Provider</code> object * @see Provider */ public static XMLSignatureFactory getInstance(String mechanismType, Provider provider) { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } else if (provider == null) { throw new NullPointerException("provider cannot be null"); } Service s = provider.getService("XMLSignatureFactory", mechanismType); if (s != null) { Object obj = null; try { obj = s.newInstance(null); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } if (obj instanceof XMLSignatureFactory) { XMLSignatureFactory factory = (XMLSignatureFactory) obj; factory.mechanismType = mechanismType; factory.provider = provider; return factory; } } throw new NoSuchMechanismException ("Mechanism " + mechanismType + " not available from " + provider.getName()); }
/** * Returns an <code>XMLSignatureFactory</code> that supports the * requested XML processing mechanism and representation type (ex: "DOM"), * as supplied by the specified provider. The specified provider must be * registered in the security provider list. * * <p>Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * * @param mechanismType the type of the XML processing mechanism and * representation. See the {@extLink security_guide_xmldsig_provider * Service Providers} section of the API overview for a list of * standard mechanism types. * @param provider the string name of the provider * @return a new <code>XMLSignatureFactory</code> * @throws NoSuchProviderException if the specified provider is not * registered in the security provider list * @throws NullPointerException if <code>provider</code> or * <code>mechanismType</code> is <code>null</code> * @throws NoSuchMechanismException if an <code>XMLSignatureFactory</code> * implementation for the specified mechanism is not * available from the specified provider * @see Provider */ public static XMLSignatureFactory getInstance(String mechanismType, String provider) throws NoSuchProviderException { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } else if (provider == null) { throw new NullPointerException("provider cannot be null"); } else if (provider.length() == 0) { throw new NoSuchProviderException(); } Provider p = Security.getProvider(provider); if (p == null) { throw new NoSuchProviderException("No such provider: " + provider); } Service s = p.getService("XMLSignatureFactory", mechanismType); if (s != null) { Object obj = null; try { obj = s.newInstance(null); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } if (obj instanceof XMLSignatureFactory) { XMLSignatureFactory factory = (XMLSignatureFactory) obj; factory.mechanismType = mechanismType; factory.provider = p; return factory; } } throw new NoSuchMechanismException ("Mechanism " + mechanismType + " not available from " + provider); }
/** * Returns a <code>KeyInfoFactory</code> that supports the * specified XML processing mechanism and representation type (ex: "DOM"). * * <p>This method uses the standard JCA provider lookup mechanism to * locate and instantiate a <code>KeyInfoFactory</code> implementation of * the desired mechanism type. It traverses the list of registered security * <code>Provider</code>s, starting with the most preferred * <code>Provider</code>. A new <code>KeyInfoFactory</code> object * from the first <code>Provider</code> that supports the specified * mechanism is returned. * * <p> Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * * @implNote * The JDK Reference Implementation additionally uses the * {@code jdk.security.provider.preferred} * {@link Security#getProperty(String) Security} property to determine * the preferred provider order for the specified algorithm. This * may be different than the order of providers returned by * {@link Security#getProviders() Security.getProviders()}. * * @param mechanismType the type of the XML processing mechanism and * representation. See the <a href= * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms"> * Java Security Standard Algorithm Names</a> document * for more information. * @return a new <code>KeyInfoFactory</code> * @throws NullPointerException if <code>mechanismType</code> is * <code>null</code> * @throws NoSuchMechanismException if no <code>Provider</code> supports a * <code>KeyInfoFactory</code> implementation for the specified mechanism * @see Provider */ public static KeyInfoFactory getInstance(String mechanismType) { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } Provider[] provs = Security.getProviders(); for (Provider p : provs) { Service s = p.getService("KeyInfoFactory", mechanismType); if (s != null) { Object obj = null; try { obj = s.newInstance(null); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } if (obj instanceof KeyInfoFactory) { KeyInfoFactory factory = (KeyInfoFactory) obj; factory.mechanismType = mechanismType; factory.provider = p; return factory; } } } throw new NoSuchMechanismException ("Mechanism " + mechanismType + " not available"); }
/** * Returns a <code>KeyInfoFactory</code> that supports the * requested XML processing mechanism and representation type (ex: "DOM"), * as supplied by the specified provider. Note that the specified * <code>Provider</code> object does not have to be registered in the * provider list. * * @param mechanismType the type of the XML processing mechanism and * representation. See the <a href= * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms"> * Java Security Standard Algorithm Names</a> document * for more information. * @param provider the <code>Provider</code> object * @return a new <code>KeyInfoFactory</code> * @throws NullPointerException if <code>mechanismType</code> or * <code>provider</code> are <code>null</code> * @throws NoSuchMechanismException if a <code>KeyInfoFactory</code> * implementation for the specified mechanism is not available from the * specified <code>Provider</code> object * @see Provider */ public static KeyInfoFactory getInstance(String mechanismType, Provider provider) { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } else if (provider == null) { throw new NullPointerException("provider cannot be null"); } Service s = provider.getService("KeyInfoFactory", mechanismType); if (s != null) { Object obj = null; try { obj = s.newInstance(null); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } if (obj instanceof KeyInfoFactory) { KeyInfoFactory factory = (KeyInfoFactory) obj; factory.mechanismType = mechanismType; factory.provider = provider; return factory; } } throw new NoSuchMechanismException ("Mechanism " + mechanismType + " not available from " + provider.getName()); }
/** * Returns a <code>KeyInfoFactory</code> that supports the * requested XML processing mechanism and representation type (ex: "DOM"), * as supplied by the specified provider. The specified provider must be * registered in the security provider list. * * <p>Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * * @param mechanismType the type of the XML processing mechanism and * representation. See the <a href= * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms"> * Java Security Standard Algorithm Names</a> document * for more information. * @param provider the string name of the provider * @return a new <code>KeyInfoFactory</code> * @throws NoSuchProviderException if the specified provider is not * registered in the security provider list * @throws NullPointerException if <code>mechanismType</code> or * <code>provider</code> are <code>null</code> * @throws NoSuchMechanismException if a <code>KeyInfoFactory</code> * implementation for the specified mechanism is not available from the * specified provider * @see Provider */ public static KeyInfoFactory getInstance(String mechanismType, String provider) throws NoSuchProviderException { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } else if (provider == null) { throw new NullPointerException("provider cannot be null"); } else if (provider.length() == 0) { throw new NoSuchProviderException(); } Provider p = Security.getProvider(provider); if (p == null) { throw new NoSuchProviderException("No such provider: " + provider); } Service s = p.getService("KeyInfoFactory", mechanismType); if (s != null) { Object obj = null; try { obj = s.newInstance(null); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } if (obj instanceof KeyInfoFactory) { KeyInfoFactory factory = (KeyInfoFactory) obj; factory.mechanismType = mechanismType; factory.provider = p; return factory; } } throw new NoSuchMechanismException ("Mechanism " + mechanismType + " not available from " + provider); }
/** * Returns an <code>XMLSignatureFactory</code> that supports the * specified XML processing mechanism and representation type (ex: "DOM"). * * <p>This method uses the standard JCA provider lookup mechanism to * locate and instantiate an <code>XMLSignatureFactory</code> * implementation of the desired mechanism type. It traverses the list of * registered security <code>Provider</code>s, starting with the most * preferred <code>Provider</code>. A new <code>XMLSignatureFactory</code> * object from the first <code>Provider</code> that supports the specified * mechanism is returned. * * <p>Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * * @param mechanismType the type of the XML processing mechanism and * representation. See the <a * href="../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider"> * Service Providers</a> section of the API overview for a list of * standard mechanism types. * @return a new <code>XMLSignatureFactory</code> * @throws NullPointerException if <code>mechanismType</code> is * <code>null</code> * @throws NoSuchMechanismException if no <code>Provider</code> supports an * <code>XMLSignatureFactory</code> implementation for the specified * mechanism * @see Provider */ public static XMLSignatureFactory getInstance(String mechanismType) { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } Instance instance; try { instance = GetInstance.getInstance ("XMLSignatureFactory", null, mechanismType); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } XMLSignatureFactory factory = (XMLSignatureFactory) instance.impl; factory.mechanismType = mechanismType; factory.provider = instance.provider; return factory; }
/** * Returns an <code>XMLSignatureFactory</code> that supports the * requested XML processing mechanism and representation type (ex: "DOM"), * as supplied by the specified provider. Note that the specified * <code>Provider</code> object does not have to be registered in the * provider list. * * @param mechanismType the type of the XML processing mechanism and * representation. See the <a * href="../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider"> * Service Providers</a> section of the API overview for a list of * standard mechanism types. * @param provider the <code>Provider</code> object * @return a new <code>XMLSignatureFactory</code> * @throws NullPointerException if <code>provider</code> or * <code>mechanismType</code> is <code>null</code> * @throws NoSuchMechanismException if an <code>XMLSignatureFactory</code> * implementation for the specified mechanism is not available * from the specified <code>Provider</code> object * @see Provider */ public static XMLSignatureFactory getInstance(String mechanismType, Provider provider) { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } else if (provider == null) { throw new NullPointerException("provider cannot be null"); } Instance instance; try { instance = GetInstance.getInstance ("XMLSignatureFactory", null, mechanismType, provider); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } XMLSignatureFactory factory = (XMLSignatureFactory) instance.impl; factory.mechanismType = mechanismType; factory.provider = instance.provider; return factory; }
/** * Returns an <code>XMLSignatureFactory</code> that supports the * requested XML processing mechanism and representation type (ex: "DOM"), * as supplied by the specified provider. The specified provider must be * registered in the security provider list. * * <p>Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * * @param mechanismType the type of the XML processing mechanism and * representation. See the <a * href="../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider"> * Service Providers</a> section of the API overview for a list of * standard mechanism types. * @param provider the string name of the provider * @return a new <code>XMLSignatureFactory</code> * @throws NoSuchProviderException if the specified provider is not * registered in the security provider list * @throws NullPointerException if <code>provider</code> or * <code>mechanismType</code> is <code>null</code> * @throws NoSuchMechanismException if an <code>XMLSignatureFactory</code> * implementation for the specified mechanism is not * available from the specified provider * @see Provider */ public static XMLSignatureFactory getInstance(String mechanismType, String provider) throws NoSuchProviderException { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } else if (provider == null) { throw new NullPointerException("provider cannot be null"); } else if (provider.length() == 0) { throw new NoSuchProviderException(); } Instance instance; try { instance = GetInstance.getInstance ("XMLSignatureFactory", null, mechanismType, provider); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } XMLSignatureFactory factory = (XMLSignatureFactory) instance.impl; factory.mechanismType = mechanismType; factory.provider = instance.provider; return factory; }
/** * Returns a <code>KeyInfoFactory</code> that supports the * specified XML processing mechanism and representation type (ex: "DOM"). * * <p>This method uses the standard JCA provider lookup mechanism to * locate and instantiate a <code>KeyInfoFactory</code> implementation of * the desired mechanism type. It traverses the list of registered security * <code>Provider</code>s, starting with the most preferred * <code>Provider</code>. A new <code>KeyInfoFactory</code> object * from the first <code>Provider</code> that supports the specified * mechanism is returned. * * <p> Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * * @param mechanismType the type of the XML processing mechanism and * representation. See the <a * href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider"> * Service Providers</a> section of the API overview for a list of * standard mechanism types. * @return a new <code>KeyInfoFactory</code> * @throws NullPointerException if <code>mechanismType</code> is * <code>null</code> * @throws NoSuchMechanismException if no <code>Provider</code> supports a * <code>KeyInfoFactory</code> implementation for the specified mechanism * @see Provider */ public static KeyInfoFactory getInstance(String mechanismType) { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } Instance instance; try { instance = GetInstance.getInstance ("KeyInfoFactory", null, mechanismType); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } KeyInfoFactory factory = (KeyInfoFactory) instance.impl; factory.mechanismType = mechanismType; factory.provider = instance.provider; return factory; }
/** * Returns a <code>KeyInfoFactory</code> that supports the * requested XML processing mechanism and representation type (ex: "DOM"), * as supplied by the specified provider. Note that the specified * <code>Provider</code> object does not have to be registered in the * provider list. * * @param mechanismType the type of the XML processing mechanism and * representation. See the <a * href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider"> * Service Providers</a> section of the API overview for a list of * standard mechanism types. * @param provider the <code>Provider</code> object * @return a new <code>KeyInfoFactory</code> * @throws NullPointerException if <code>mechanismType</code> or * <code>provider</code> are <code>null</code> * @throws NoSuchMechanismException if a <code>KeyInfoFactory</code> * implementation for the specified mechanism is not available from the * specified <code>Provider</code> object * @see Provider */ public static KeyInfoFactory getInstance(String mechanismType, Provider provider) { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } else if (provider == null) { throw new NullPointerException("provider cannot be null"); } Instance instance; try { instance = GetInstance.getInstance ("KeyInfoFactory", null, mechanismType, provider); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } KeyInfoFactory factory = (KeyInfoFactory) instance.impl; factory.mechanismType = mechanismType; factory.provider = instance.provider; return factory; }
/** * Returns a <code>KeyInfoFactory</code> that supports the * requested XML processing mechanism and representation type (ex: "DOM"), * as supplied by the specified provider. The specified provider must be * registered in the security provider list. * * <p>Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * * @param mechanismType the type of the XML processing mechanism and * representation. See the <a * href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider"> * Service Providers</a> section of the API overview for a list of * standard mechanism types. * @param provider the string name of the provider * @return a new <code>KeyInfoFactory</code> * @throws NoSuchProviderException if the specified provider is not * registered in the security provider list * @throws NullPointerException if <code>mechanismType</code> or * <code>provider</code> are <code>null</code> * @throws NoSuchMechanismException if a <code>KeyInfoFactory</code> * implementation for the specified mechanism is not available from the * specified provider * @see Provider */ public static KeyInfoFactory getInstance(String mechanismType, String provider) throws NoSuchProviderException { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } else if (provider == null) { throw new NullPointerException("provider cannot be null"); } else if (provider.length() == 0) { throw new NoSuchProviderException(); } Instance instance; try { instance = GetInstance.getInstance ("KeyInfoFactory", null, mechanismType, provider); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } KeyInfoFactory factory = (KeyInfoFactory) instance.impl; factory.mechanismType = mechanismType; factory.provider = instance.provider; return factory; }
/** * Returns an <code>XMLSignatureFactory</code> that supports the * specified XML processing mechanism and representation type (ex: "DOM"). * * <p>This method uses the standard JCA provider lookup mechanism to * locate and instantiate an <code>XMLSignatureFactory</code> * implementation of the desired mechanism type. It traverses the list of * registered security <code>Provider</code>s, starting with the most * preferred <code>Provider</code>. A new <code>XMLSignatureFactory</code> * object from the first <code>Provider</code> that supports the specified * mechanism is returned. * * <p>Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * * @implNote * The JDK Reference Implementation additionally uses the * {@code jdk.security.provider.preferred} * {@link Security#getProperty(String) Security} property to determine * the preferred provider order for the specified algorithm. This * may be different than the order of providers returned by * {@link Security#getProviders() Security.getProviders()}. * * @param mechanismType the type of the XML processing mechanism and * representation. See the {@extLink security_guide_xmldsig_provider * Service Providers} section of the API overview for a list of * standard mechanism types. * @return a new <code>XMLSignatureFactory</code> * @throws NullPointerException if <code>mechanismType</code> is * <code>null</code> * @throws NoSuchMechanismException if no <code>Provider</code> supports an * <code>XMLSignatureFactory</code> implementation for the specified * mechanism * @see Provider */ public static XMLSignatureFactory getInstance(String mechanismType) { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } Provider[] provs = Security.getProviders(); for (Provider p : provs) { Service s = p.getService("XMLSignatureFactory", mechanismType); if (s != null) { Object obj = null; try { obj = s.newInstance(null); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } if (obj instanceof XMLSignatureFactory) { XMLSignatureFactory factory = (XMLSignatureFactory) obj; factory.mechanismType = mechanismType; factory.provider = p; return factory; } } } throw new NoSuchMechanismException ("Mechanism " + mechanismType + " not available"); }
/** * Returns an <code>XMLSignatureFactory</code> that supports the * specified XML processing mechanism and representation type (ex: "DOM"). * * <p>This method uses the standard JCA provider lookup mechanism to * locate and instantiate an <code>XMLSignatureFactory</code> * implementation of the desired mechanism type. It traverses the list of * registered security <code>Provider</code>s, starting with the most * preferred <code>Provider</code>. A new <code>XMLSignatureFactory</code> * object from the first <code>Provider</code> that supports the specified * mechanism is returned. * * <p>Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * * @implNote * The JDK Reference Implementation additionally uses the * {@code jdk.security.provider.preferred} * {@link Security#getProperty(String) Security} property to determine * the preferred provider order for the specified algorithm. This * may be different than the order of providers returned by * {@link Security#getProviders() Security.getProviders()}. * * @param mechanismType the type of the XML processing mechanism and * representation. See the <a * href="../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider"> * Service Providers</a> section of the API overview for a list of * standard mechanism types. * @return a new <code>XMLSignatureFactory</code> * @throws NullPointerException if <code>mechanismType</code> is * <code>null</code> * @throws NoSuchMechanismException if no <code>Provider</code> supports an * <code>XMLSignatureFactory</code> implementation for the specified * mechanism * @see Provider */ public static XMLSignatureFactory getInstance(String mechanismType) { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } Instance instance; try { instance = GetInstance.getInstance ("XMLSignatureFactory", null, mechanismType); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } XMLSignatureFactory factory = (XMLSignatureFactory) instance.impl; factory.mechanismType = mechanismType; factory.provider = instance.provider; return factory; }
/** * Returns an <code>XMLSignatureFactory</code> that supports the * requested XML processing mechanism and representation type (ex: "DOM"), * as supplied by the specified provider. Note that the specified * <code>Provider</code> object does not have to be registered in the * provider list. * * @param mechanismType the type of the XML processing mechanism and * representation. See the <a * href="../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider"> * Service Providers</a> section of the API overview for a list of * standard mechanism types. * @param provider the <code>Provider</code> object * @return a new <code>XMLSignatureFactory</code> * @throws NullPointerException if <code>provider</code> or * <code>mechanismType</code> is <code>null</code> * @throws NoSuchMechanismException if an <code>XMLSignatureFactory</code> * implementation for the specified mechanism is not available * from the specified <code>Provider</code> object * @see Provider */ public static XMLSignatureFactory getInstance(String mechanismType, Provider provider) { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } else if (provider == null) { throw new NullPointerException("provider cannot be null"); } Instance instance; try { instance = GetInstance.getInstance ("XMLSignatureFactory", null, mechanismType, provider); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } XMLSignatureFactory factory = (XMLSignatureFactory) instance.impl; factory.mechanismType = mechanismType; factory.provider = instance.provider; return factory; }
/** * Returns an <code>XMLSignatureFactory</code> that supports the * requested XML processing mechanism and representation type (ex: "DOM"), * as supplied by the specified provider. The specified provider must be * registered in the security provider list. * * <p>Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * * @param mechanismType the type of the XML processing mechanism and * representation. See the <a * href="../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider"> * Service Providers</a> section of the API overview for a list of * standard mechanism types. * @param provider the string name of the provider * @return a new <code>XMLSignatureFactory</code> * @throws NoSuchProviderException if the specified provider is not * registered in the security provider list * @throws NullPointerException if <code>provider</code> or * <code>mechanismType</code> is <code>null</code> * @throws NoSuchMechanismException if an <code>XMLSignatureFactory</code> * implementation for the specified mechanism is not * available from the specified provider * @see Provider */ public static XMLSignatureFactory getInstance(String mechanismType, String provider) throws NoSuchProviderException { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } else if (provider == null) { throw new NullPointerException("provider cannot be null"); } else if (provider.length() == 0) { throw new NoSuchProviderException(); } Instance instance; try { instance = GetInstance.getInstance ("XMLSignatureFactory", null, mechanismType, provider); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } XMLSignatureFactory factory = (XMLSignatureFactory) instance.impl; factory.mechanismType = mechanismType; factory.provider = instance.provider; return factory; }
/** * Returns a <code>KeyInfoFactory</code> that supports the * specified XML processing mechanism and representation type (ex: "DOM"). * * <p>This method uses the standard JCA provider lookup mechanism to * locate and instantiate a <code>KeyInfoFactory</code> implementation of * the desired mechanism type. It traverses the list of registered security * <code>Provider</code>s, starting with the most preferred * <code>Provider</code>. A new <code>KeyInfoFactory</code> object * from the first <code>Provider</code> that supports the specified * mechanism is returned. * * <p> Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * * @implNote * The JDK Reference Implementation additionally uses the * {@code jdk.security.provider.preferred} * {@link Security#getProperty(String) Security} property to determine * the preferred provider order for the specified algorithm. This * may be different than the order of providers returned by * {@link Security#getProviders() Security.getProviders()}. * * @param mechanismType the type of the XML processing mechanism and * representation. See the <a * href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider"> * Service Providers</a> section of the API overview for a list of * standard mechanism types. * @return a new <code>KeyInfoFactory</code> * @throws NullPointerException if <code>mechanismType</code> is * <code>null</code> * @throws NoSuchMechanismException if no <code>Provider</code> supports a * <code>KeyInfoFactory</code> implementation for the specified mechanism * @see Provider */ public static KeyInfoFactory getInstance(String mechanismType) { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } Instance instance; try { instance = GetInstance.getInstance ("KeyInfoFactory", null, mechanismType); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } KeyInfoFactory factory = (KeyInfoFactory) instance.impl; factory.mechanismType = mechanismType; factory.provider = instance.provider; return factory; }
/** * Returns a <code>KeyInfoFactory</code> that supports the * requested XML processing mechanism and representation type (ex: "DOM"), * as supplied by the specified provider. Note that the specified * <code>Provider</code> object does not have to be registered in the * provider list. * * @param mechanismType the type of the XML processing mechanism and * representation. See the <a * href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider"> * Service Providers</a> section of the API overview for a list of * standard mechanism types. * @param provider the <code>Provider</code> object * @return a new <code>KeyInfoFactory</code> * @throws NullPointerException if <code>mechanismType</code> or * <code>provider</code> are <code>null</code> * @throws NoSuchMechanismException if a <code>KeyInfoFactory</code> * implementation for the specified mechanism is not available from the * specified <code>Provider</code> object * @see Provider */ public static KeyInfoFactory getInstance(String mechanismType, Provider provider) { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } else if (provider == null) { throw new NullPointerException("provider cannot be null"); } Instance instance; try { instance = GetInstance.getInstance ("KeyInfoFactory", null, mechanismType, provider); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } KeyInfoFactory factory = (KeyInfoFactory) instance.impl; factory.mechanismType = mechanismType; factory.provider = instance.provider; return factory; }
/** * Returns a <code>KeyInfoFactory</code> that supports the * requested XML processing mechanism and representation type (ex: "DOM"), * as supplied by the specified provider. The specified provider must be * registered in the security provider list. * * <p>Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * * @param mechanismType the type of the XML processing mechanism and * representation. See the <a * href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service%20Provider"> * Service Providers</a> section of the API overview for a list of * standard mechanism types. * @param provider the string name of the provider * @return a new <code>KeyInfoFactory</code> * @throws NoSuchProviderException if the specified provider is not * registered in the security provider list * @throws NullPointerException if <code>mechanismType</code> or * <code>provider</code> are <code>null</code> * @throws NoSuchMechanismException if a <code>KeyInfoFactory</code> * implementation for the specified mechanism is not available from the * specified provider * @see Provider */ public static KeyInfoFactory getInstance(String mechanismType, String provider) throws NoSuchProviderException { if (mechanismType == null) { throw new NullPointerException("mechanismType cannot be null"); } else if (provider == null) { throw new NullPointerException("provider cannot be null"); } else if (provider.length() == 0) { throw new NoSuchProviderException(); } Instance instance; try { instance = GetInstance.getInstance ("KeyInfoFactory", null, mechanismType, provider); } catch (NoSuchAlgorithmException nsae) { throw new NoSuchMechanismException(nsae); } KeyInfoFactory factory = (KeyInfoFactory) instance.impl; factory.mechanismType = mechanismType; factory.provider = instance.provider; return factory; }