/// <summary> /// Returns a certificate factory object for the specified /// certificate type. /// /// <para> A new CertificateFactory object encapsulating the /// CertificateFactorySpi implementation from the specified Provider /// object is returned. Note that the specified Provider object /// does not have to be registered in the provider list. /// /// </para> /// </summary> /// <param name="type"> the certificate type. /// See the CertificateFactory section in the <a href= /// "{@docRoot}/../technotes/guides/security/StandardNames.html#CertificateFactory"> /// Java Cryptography Architecture Standard Algorithm Name Documentation</a> /// for information about standard certificate types. </param> /// <param name="provider"> the provider. /// </param> /// <returns> a certificate factory object for the specified type. /// </returns> /// <exception cref="CertificateException"> if a CertificateFactorySpi /// implementation for the specified algorithm is not available /// from the specified Provider object. /// </exception> /// <exception cref="IllegalArgumentException"> if the {@code provider} is /// null. /// </exception> /// <seealso cref= java.security.Provider /// /// @since 1.4 </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static final CertificateFactory getInstance(String type, java.security.Provider provider) throws CertificateException public static CertificateFactory GetInstance(String type, Provider provider) { try { Instance instance = GetInstance.getInstance("CertificateFactory", typeof(CertificateFactorySpi), type, provider); return(new CertificateFactory((CertificateFactorySpi)instance.impl, instance.provider, type)); } catch (NoSuchAlgorithmException e) { throw new CertificateException(type + " not found", e); } }
/// <summary> /// Returns a Policy object of the specified type. /// /// <para> This method traverses the list of registered security providers, /// starting with the most preferred Provider. /// A new Policy object encapsulating the /// PolicySpi implementation from the first /// Provider that supports the specified type is returned. /// /// </para> /// <para> Note that the list of registered providers may be retrieved via /// the <seealso cref="Security#getProviders() Security.getProviders()"/> method. /// /// </para> /// </summary> /// <param name="type"> the specified Policy type. See the Policy section in the /// <a href= /// "{@docRoot}/../technotes/guides/security/StandardNames.html#Policy"> /// Java Cryptography Architecture Standard Algorithm Name Documentation</a> /// for a list of standard Policy types. /// </param> /// <param name="params"> parameters for the Policy, which may be null. /// </param> /// <returns> the new Policy object. /// </returns> /// <exception cref="SecurityException"> if the caller does not have permission /// to get a Policy instance for the specified type. /// </exception> /// <exception cref="NullPointerException"> if the specified type is null. /// </exception> /// <exception cref="IllegalArgumentException"> if the specified parameters /// are not understood by the PolicySpi implementation /// from the selected Provider. /// </exception> /// <exception cref="NoSuchAlgorithmException"> if no Provider supports a PolicySpi /// implementation for the specified type. /// </exception> /// <seealso cref= Provider /// @since 1.6 </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static Policy getInstance(String type, Policy.Parameters params) throws NoSuchAlgorithmException public static Policy GetInstance(String type, Policy.Parameters @params) { CheckPermission(type); try { GetInstance.Instance instance = GetInstance.getInstance("Policy", typeof(PolicySpi), type, @params); return(new PolicyDelegate((PolicySpi)instance.impl, instance.provider, type, @params)); } catch (NoSuchAlgorithmException nsae) { return(HandleException(nsae)); } }
/// <summary> /// Returns a Policy object of the specified type. /// /// <para> A new Policy object encapsulating the /// PolicySpi implementation from the specified Provider /// object is returned. Note that the specified Provider object /// does not have to be registered in the provider list. /// /// </para> /// </summary> /// <param name="type"> the specified Policy type. See the Policy section in the /// <a href= /// "{@docRoot}/../technotes/guides/security/StandardNames.html#Policy"> /// Java Cryptography Architecture Standard Algorithm Name Documentation</a> /// for a list of standard Policy types. /// </param> /// <param name="params"> parameters for the Policy, which may be null. /// </param> /// <param name="provider"> the Provider. /// </param> /// <returns> the new Policy object. /// </returns> /// <exception cref="SecurityException"> if the caller does not have permission /// to get a Policy instance for the specified type. /// </exception> /// <exception cref="NullPointerException"> if the specified type is null. /// </exception> /// <exception cref="IllegalArgumentException"> if the specified Provider is null, /// or if the specified parameters are not understood by /// the PolicySpi implementation from the specified Provider. /// </exception> /// <exception cref="NoSuchAlgorithmException"> if the specified Provider does not /// support a PolicySpi implementation for the specified type. /// </exception> /// <seealso cref= Provider /// @since 1.6 </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static Policy getInstance(String type, Policy.Parameters params, Provider provider) throws NoSuchAlgorithmException public static Policy GetInstance(String type, Policy.Parameters @params, Provider provider) { if (provider == null) { throw new IllegalArgumentException("missing provider"); } CheckPermission(type); try { GetInstance.Instance instance = GetInstance.getInstance("Policy", typeof(PolicySpi), type, @params, provider); return(new PolicyDelegate((PolicySpi)instance.impl, instance.provider, type, @params)); } catch (NoSuchAlgorithmException nsae) { return(HandleException(nsae)); } }
/// <summary> /// Returns a KeyPairGenerator object that generates public/private /// key pairs for the specified algorithm. /// /// <para> This method traverses the list of registered security Providers, /// starting with the most preferred Provider. /// A new KeyPairGenerator object encapsulating the /// KeyPairGeneratorSpi implementation from the first /// Provider that supports the specified algorithm is returned. /// /// </para> /// <para> Note that the list of registered providers may be retrieved via /// the <seealso cref="Security#getProviders() Security.getProviders()"/> method. /// /// </para> /// </summary> /// <param name="algorithm"> the standard string name of the algorithm. /// See the KeyPairGenerator section in the <a href= /// "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyPairGenerator"> /// Java Cryptography Architecture Standard Algorithm Name Documentation</a> /// for information about standard algorithm names. /// </param> /// <returns> the new KeyPairGenerator object. /// </returns> /// <exception cref="NoSuchAlgorithmException"> if no Provider supports a /// KeyPairGeneratorSpi implementation for the /// specified algorithm. /// </exception> /// <seealso cref= Provider </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static KeyPairGenerator getInstance(String algorithm) throws NoSuchAlgorithmException public static KeyPairGenerator GetInstance(String algorithm) { List <Service> list = GetInstance.getServices("KeyPairGenerator", algorithm); Iterator <Service> t = list.Iterator(); if (t.HasNext() == false) { throw new NoSuchAlgorithmException(algorithm + " KeyPairGenerator not available"); } // find a working Spi or KeyPairGenerator subclass NoSuchAlgorithmException failure = null; do { Service s = t.Next(); try { Instance instance = GetInstance.getInstance(s, typeof(KeyPairGeneratorSpi)); if (instance.impl is KeyPairGenerator) { return(GetInstance(instance, algorithm)); } else { return(new Delegate(instance, t, algorithm)); } } catch (NoSuchAlgorithmException e) { if (failure == null) { failure = e; } } } while (t.HasNext()); throw failure; }
/// <summary> /// Returns a {@code CertPathBuilder} object that implements the /// specified algorithm. /// /// <para> A new CertPathBuilder object encapsulating the /// CertPathBuilderSpi implementation from the specified Provider /// object is returned. Note that the specified Provider object /// does not have to be registered in the provider list. /// /// </para> /// </summary> /// <param name="algorithm"> the name of the requested {@code CertPathBuilder} /// algorithm. See the CertPathBuilder section in the <a href= /// "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathBuilder"> /// Java Cryptography Architecture Standard Algorithm Name Documentation</a> /// for information about standard algorithm names. /// </param> /// <param name="provider"> the provider. /// </param> /// <returns> a {@code CertPathBuilder} object that implements the /// specified algorithm. /// </returns> /// <exception cref="NoSuchAlgorithmException"> if a CertPathBuilderSpi /// implementation for the specified algorithm is not available /// from the specified Provider object. /// </exception> /// <exception cref="IllegalArgumentException"> if the {@code provider} is /// null. /// </exception> /// <seealso cref= java.security.Provider </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static CertPathBuilder getInstance(String algorithm, java.security.Provider provider) throws java.security.NoSuchAlgorithmException public static CertPathBuilder GetInstance(String algorithm, Provider provider) { Instance instance = GetInstance.getInstance("CertPathBuilder", typeof(CertPathBuilderSpi), algorithm, provider); return(new CertPathBuilder((CertPathBuilderSpi)instance.impl, instance.provider, algorithm)); }
/// <summary> /// Returns a {@code CertPathValidator} object that implements the /// specified algorithm. /// /// <para> A new CertPathValidator object encapsulating the /// CertPathValidatorSpi implementation from the specified provider /// is returned. The specified provider must be registered /// in the security provider list. /// /// </para> /// <para> Note that the list of registered providers may be retrieved via /// the <seealso cref="Security#getProviders() Security.getProviders()"/> method. /// /// </para> /// </summary> /// <param name="algorithm"> the name of the requested {@code CertPathValidator} /// algorithm. See the CertPathValidator section in the <a href= /// "{@docRoot}/../technotes/guides/security/StandardNames.html#CertPathValidator"> /// Java Cryptography Architecture Standard Algorithm Name Documentation</a> /// for information about standard algorithm names. /// </param> /// <param name="provider"> the name of the provider. /// </param> /// <returns> a {@code CertPathValidator} object that implements the /// specified algorithm. /// </returns> /// <exception cref="NoSuchAlgorithmException"> if a CertPathValidatorSpi /// implementation for the specified algorithm is not /// available from the specified provider. /// </exception> /// <exception cref="NoSuchProviderException"> if the specified provider is not /// registered in the security provider list. /// </exception> /// <exception cref="IllegalArgumentException"> if the {@code provider} is /// null or empty. /// </exception> /// <seealso cref= java.security.Provider </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static CertPathValidator getInstance(String algorithm, String provider) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException public static CertPathValidator GetInstance(String algorithm, String provider) { Instance instance = GetInstance.getInstance("CertPathValidator", typeof(CertPathValidatorSpi), algorithm, provider); return(new CertPathValidator((CertPathValidatorSpi)instance.impl, instance.provider, algorithm)); }
/// <summary> /// Returns a KeyFactory object that converts /// public/private keys of the specified algorithm. /// /// <para> A new KeyFactory object encapsulating the /// KeyFactorySpi implementation from the specified Provider /// object is returned. Note that the specified Provider object /// does not have to be registered in the provider list. /// /// </para> /// </summary> /// <param name="algorithm"> the name of the requested key algorithm. /// See the KeyFactory section in the <a href= /// "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyFactory"> /// Java Cryptography Architecture Standard Algorithm Name Documentation</a> /// for information about standard algorithm names. /// </param> /// <param name="provider"> the provider. /// </param> /// <returns> the new KeyFactory object. /// </returns> /// <exception cref="NoSuchAlgorithmException"> if a KeyFactorySpi /// implementation for the specified algorithm is not available /// from the specified Provider object. /// </exception> /// <exception cref="IllegalArgumentException"> if the specified provider is null. /// </exception> /// <seealso cref= Provider /// /// @since 1.4 </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static KeyFactory getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException public static KeyFactory GetInstance(String algorithm, Provider provider) { Instance instance = GetInstance.getInstance("KeyFactory", typeof(KeyFactorySpi), algorithm, provider); return(new KeyFactory((KeyFactorySpi)instance.impl, instance.provider, algorithm)); }
/// <summary> /// Returns a KeyPairGenerator object that generates public/private /// key pairs for the specified algorithm. /// /// <para> A new KeyPairGenerator object encapsulating the /// KeyPairGeneratorSpi implementation from the specified Provider /// object is returned. Note that the specified Provider object /// does not have to be registered in the provider list. /// /// </para> /// </summary> /// <param name="algorithm"> the standard string name of the algorithm. /// See the KeyPairGenerator section in the <a href= /// "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyPairGenerator"> /// Java Cryptography Architecture Standard Algorithm Name Documentation</a> /// for information about standard algorithm names. /// </param> /// <param name="provider"> the provider. /// </param> /// <returns> the new KeyPairGenerator object. /// </returns> /// <exception cref="NoSuchAlgorithmException"> if a KeyPairGeneratorSpi /// implementation for the specified algorithm is not available /// from the specified Provider object. /// </exception> /// <exception cref="IllegalArgumentException"> if the specified provider is null. /// </exception> /// <seealso cref= Provider /// /// @since 1.4 </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static KeyPairGenerator getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException public static KeyPairGenerator GetInstance(String algorithm, Provider provider) { Instance instance = GetInstance.getInstance("KeyPairGenerator", typeof(KeyPairGeneratorSpi), algorithm, provider); return(GetInstance(instance, algorithm)); }
/// <summary> /// Returns a SecureRandom object that implements the specified /// Random Number Generator (RNG) algorithm. /// /// <para> A new SecureRandom object encapsulating the /// SecureRandomSpi implementation from the specified Provider /// object is returned. Note that the specified Provider object /// does not have to be registered in the provider list. /// /// </para> /// <para> The returned SecureRandom object has not been seeded. To seed the /// returned object, call the {@code setSeed} method. /// If {@code setSeed} is not called, the first call to /// {@code nextBytes} will force the SecureRandom object to seed itself. /// This self-seeding will not occur if {@code setSeed} was /// previously called. /// /// </para> /// </summary> /// <param name="algorithm"> the name of the RNG algorithm. /// See the SecureRandom section in the <a href= /// "{@docRoot}/../technotes/guides/security/StandardNames.html#SecureRandom"> /// Java Cryptography Architecture Standard Algorithm Name Documentation</a> /// for information about standard RNG algorithm names. /// </param> /// <param name="provider"> the provider. /// </param> /// <returns> the new SecureRandom object. /// </returns> /// <exception cref="NoSuchAlgorithmException"> if a SecureRandomSpi /// implementation for the specified algorithm is not available /// from the specified Provider object. /// </exception> /// <exception cref="IllegalArgumentException"> if the specified provider is null. /// </exception> /// <seealso cref= Provider /// /// @since 1.4 </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static SecureRandom getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException public static SecureRandom GetInstance(String algorithm, Provider provider) { Instance instance = GetInstance.getInstance("SecureRandom", typeof(SecureRandomSpi), algorithm, provider); return(new SecureRandom((SecureRandomSpi)instance.impl, instance.provider, algorithm)); }