private Policy(PolicySpi spi, Provider p, String t, Policy.Parameters para) { this.spiImpl = spi; this.provider = p; this.type = t; this.paramsJ = para; }
internal PolicyDelegate(PolicySpi spi, Provider p, String type, Policy.Parameters @params) { this.Spi = spi; this.p = p; this.Type_Renamed = type; this.@params = @params; }
/** * Answers a Policy object of the specified type. * * 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. * * @param type - * the specified Policy type. So far in Java 6, only 'JavaPolicy' * supported. * @param paramsJ - * the Policy.Parameter object, which may be null. * @param provider - * the Policy service Provider. * @return the new Policy object. * * @throws NoSuchAlgorithmException - * if the specified Provider does not support a PolicySpi * implementation for the specified type. * @throws IllegalArgumentException - * if the specified Provider is null, or if the specified * parameters' type are not allowed by the PolicySpi * implementation from the specified Provider. * @throws NullPointerException - * if the specified type is null. * @throws SecurityException - * if the caller does not have permission to get a Policy * instance for the specified type. * @since 1.6 */ public static Policy getInstance(String type, Policy.Parameters paramsJ, Provider provider)//throws NoSuchAlgorithmException { { if (provider == null) { throw new java.lang.IllegalArgumentException("security.04"); //$NON-NLS-1$ } checkSecurityPermission(new SecurityPermission(CREATE_POLICY + type)); return(getInstanceImpl(type, paramsJ, provider)); }
/// <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)); } }
/** * Answers a Policy object of the specified type. * * A new Policy object encapsulating the PolicySpi implementation from the * specified provider is returned. The specified provider must be registered * in the provider list via the Security.getProviders() method, otherwise * NoSuchProviderException will be thrown. * * @param type - * the specified Policy type. So far in Java 6, only 'JavaPolicy' * supported. * @param paramsJ - * the Policy.Parameter object, which may be null. * @param provider - * the provider. * @return the new Policy object. * * @throws NoSuchProviderException - * if the specified provider is not registered in the security * provider list. * @throws NoSuchAlgorithmException - * if the specified provider does not support a PolicySpi * implementation for the specified type. * @throws SecurityException - * if the caller does not have permission to get a Policy * instance for the specified type. * @throws NullPointerException - * if the specified type is null. * @throws IllegalArgumentException - * if the specified Provider is null, or if the specified * parameters' type are not allowed by the PolicySpi * implementation from the specified Provider. * * @since 1.6 */ public static Policy getInstance(String type, Policy.Parameters paramsJ, String provider) //throws NoSuchProviderException, { //NoSuchAlgorithmException { if ((provider == null) || provider.isEmpty()) { throw new java.lang.IllegalArgumentException("Provider is null or empty string"); } checkSecurityPermission(new SecurityPermission(CREATE_POLICY + type)); Provider impProvider = Security.getProvider(provider); if (impProvider == null) { throw new NoSuchProviderException("Provider " + provider + " is not available"); } return(getInstanceImpl(type, paramsJ, impProvider)); }
/// <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)); } }
private static Policy getInstanceImpl(String type, Policy.Parameters paramsJ, Provider provider)//throws NoSuchAlgorithmException { { if (type == null) { throw new java.lang.NullPointerException(); } try { lock (engine) { engine.getInstance(type, provider, paramsJ); return(new PolicyDelegate((PolicySpi)engine.spi, provider, type, paramsJ)); } } catch (NoSuchAlgorithmException e) { if (e.getCause() == null) { throw e; } throw new java.lang.IllegalArgumentException("Unrecognized policy parameter: " + paramsJ.toString()); //$NON-NLS-1$ } }
/** * Answers a Policy object with the specified type and the specified * parameter. * * Traverses the list of registered security providers, beginning with the * most preferred Provider. A new Policy object encapsulating the PolicySpi * implementation from the first Provider that supports the specified type * is returned. * * Note that the list of registered providers may be retrieved via the * Security.getProviders() method. * * @param type - * the specified Policy type. See Appendix A in the Java * Cryptography Architecture API Specification & Reference for a * list of standard Policy types. * @param paramsJ - * parameters for the Policy, which may be null. * @return the new Policy object. * @throws NoSuchAlgorithmException - * if no Provider supports a PolicySpi implementation for the * specified type. * @throws SecurityException - * if the caller does not have permission to get a Policy * instance for the specified type. * @throws NullPointerException - * if the specified type is null. * @throws IllegalArgumentException - * if the specified parameters' type are not allowed by the * PolicySpi implementation from the selected Provider. * * @since 1.6 */ public static Policy getInstance(String type, Policy.Parameters paramsJ) {// throws NoSuchAlgorithmException { checkSecurityPermission(new SecurityPermission(CREATE_POLICY + type)); if (type == null) { throw new java.lang.NullPointerException(); } try { lock (engine) { engine.getInstance(type, paramsJ); return(new PolicyDelegate((PolicySpi)engine.spi, engine.provider, type, paramsJ)); } } catch (NoSuchAlgorithmException e) { if (e.getCause() == null) { throw e; } throw new java.lang.IllegalArgumentException("Unrecognized policy parameter: " + paramsJ.toString()); //$NON-NLS-1$ } }
public PolicyDelegate(PolicySpi spi, Provider p, String t, Policy.Parameters para) : base(spi, p, t, para) { }