// engine method public override void Initialize(int keysize, SecureRandom random) { if (ServiceIterator == null) { Spi.Initialize(keysize, random); return; } RuntimeException failure = null; KeyPairGeneratorSpi mySpi = Spi; do { try { mySpi.Initialize(keysize, random); InitType = I_SIZE; InitKeySize = keysize; InitParams = null; InitRandom = random; return; } catch (RuntimeException e) { if (failure == null) { failure = e; } mySpi = NextSpi(mySpi, false); } } while (mySpi != null); throw failure; }
internal override void DisableFailover() { ServiceIterator = null; InitType = 0; InitParams = null; InitRandom = null; }
/// <summary> /// Initializes this parameter object using the parameters /// specified in {@code paramSpec}. /// </summary> /// <param name="paramSpec"> the parameter specification. /// </param> /// <exception cref="InvalidParameterSpecException"> if the given parameter /// specification is inappropriate for the initialization of this parameter /// object, or if this parameter object has already been initialized. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public final void init(java.security.spec.AlgorithmParameterSpec paramSpec) throws java.security.spec.InvalidParameterSpecException public void Init(AlgorithmParameterSpec paramSpec) { if (this.Initialized) { throw new InvalidParameterSpecException("already initialized"); } ParamSpi.EngineInit(paramSpec); this.Initialized = true; }
/// <summary> /// Initializes the key pair generator with the given parameter /// set and source of randomness. /// /// <para>This concrete method has been added to this previously-defined /// abstract class. /// This method calls the KeyPairGeneratorSpi {@link /// KeyPairGeneratorSpi#initialize( /// java.security.spec.AlgorithmParameterSpec, /// java.security.SecureRandom) initialize} method, /// passing it {@code params} and {@code random}. /// That {@code initialize} /// method always throws an /// UnsupportedOperationException if it is not overridden by the provider. /// /// </para> /// </summary> /// <param name="params"> the parameter set used to generate the keys. </param> /// <param name="random"> the source of randomness. /// </param> /// <exception cref="InvalidAlgorithmParameterException"> if the given parameters /// are inappropriate for this key pair generator. /// /// @since 1.2 </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void initialize(java.security.spec.AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException public override void Initialize(AlgorithmParameterSpec @params, SecureRandom random) { // This does nothing, because either // 1. the implementation object returned by getInstance() is an // instance of KeyPairGenerator which has its own // initialize(params, random) method, so the application would // be calling that method directly, or // 2. the implementation returned by getInstance() is an instance // of Delegate, in which case initialize(params, random) is // overridden to call the corresponding SPI method. // (This is a special case, because the API and SPI method have the // same name.) }
public void Init(int cipherMode, IKey key, AlgorithmParameterSpec aps) { ICipherParameters cp; if (aps is RC2ParameterSpec) { cp = new RC2Parameters(key.GetEncoded(), (aps as RC2ParameterSpec).GetEffectiveKeyBits()); } else if (aps is IvParameterSpec) { cp = new KeyParameter(key.GetEncoded()); cp = new ParametersWithIV(cp, (aps as IvParameterSpec).GetIV()); } else { throw new NotImplementedException(); } cipherImpl.Init(cipherMode == ENCRYPT_MODE, cp); }
// engine method //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void initialize(java.security.spec.AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException public override void Initialize(AlgorithmParameterSpec @params, SecureRandom random) { if (ServiceIterator == null) { Spi.Initialize(@params, random); return; } Exception failure = null; KeyPairGeneratorSpi mySpi = Spi; do { try { mySpi.Initialize(@params, random); InitType = I_PARAMS; InitKeySize = 0; InitParams = @params; InitRandom = random; return; } catch (Exception e) { if (failure == null) { failure = e; } mySpi = NextSpi(mySpi, false); } } while (mySpi != null); if (failure is RuntimeException) { throw (RuntimeException)failure; } // must be an InvalidAlgorithmParameterException throw (InvalidAlgorithmParameterException)failure; }
/// <summary> /// Creates a new {@code PSSParameterSpec} as defined in /// the PKCS #1 standard using the specified message digest, /// mask generation function, parameters for mask generation /// function, salt length, and trailer field values. /// </summary> /// <param name="mdName"> the algorithm name of the hash function. </param> /// <param name="mgfName"> the algorithm name of the mask generation /// function. </param> /// <param name="mgfSpec"> the parameters for the mask generation /// function. If null is specified, null will be returned by /// getMGFParameters(). </param> /// <param name="saltLen"> the length of salt. </param> /// <param name="trailerField"> the value of the trailer field. </param> /// <exception cref="NullPointerException"> if {@code mdName}, /// or {@code mgfName} is null. </exception> /// <exception cref="IllegalArgumentException"> if {@code saltLen} /// or {@code trailerField} is less than 0. /// @since 1.5 </exception> public PSSParameterSpec(String mdName, String mgfName, AlgorithmParameterSpec mgfSpec, int saltLen, int trailerField) { if (mdName == null) { throw new NullPointerException("digest algorithm is null"); } if (mgfName == null) { throw new NullPointerException("mask generation function " + "algorithm is null"); } if (saltLen < 0) { throw new IllegalArgumentException("negative saltLen value: " + saltLen); } if (trailerField < 0) { throw new IllegalArgumentException("negative trailerField: " + trailerField); } this.MdName = mdName; this.MgfName = mgfName; this.MgfSpec = mgfSpec; this.SaltLen = saltLen; this.TrailerField_Renamed = trailerField; }
public virtual void Initialize(AlgorithmParameterSpec pars) { throw new NotSupportedException (); }
/// <summary> /// Initializes this parameter generator with a set of /// algorithm-specific parameter generation values. /// </summary> /// <param name="genParamSpec"> the set of algorithm-specific parameter generation values. </param> /// <param name="random"> the source of randomness. /// </param> /// <exception cref="InvalidAlgorithmParameterException"> if the given parameter /// generation values are inappropriate for this parameter generator. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected abstract void engineInit(java.security.spec.AlgorithmParameterSpec genParamSpec, SecureRandom random) throws InvalidAlgorithmParameterException; protected internal abstract void EngineInit(AlgorithmParameterSpec genParamSpec, SecureRandom random);
/// <summary> /// Initializes this parameter generator with a set of algorithm-specific /// parameter generation values. /// </summary> /// <param name="genParamSpec"> the set of algorithm-specific parameter generation values. </param> /// <param name="random"> the source of randomness. /// </param> /// <exception cref="InvalidAlgorithmParameterException"> if the given parameter /// generation values are inappropriate for this parameter generator. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public final void init(java.security.spec.AlgorithmParameterSpec genParamSpec, SecureRandom random) throws InvalidAlgorithmParameterException public void Init(AlgorithmParameterSpec genParamSpec, SecureRandom random) { ParamGenSpi.EngineInit(genParamSpec, random); }
/// <summary> /// Initializes the key pair generator using the specified parameter /// set and the {@code SecureRandom} /// implementation of the highest-priority installed provider as the source /// of randomness. /// (If none of the installed providers supply an implementation of /// {@code SecureRandom}, a system-provided source of randomness is /// used.). /// /// <para>This concrete method has been added to this previously-defined /// abstract class. /// This method calls the KeyPairGeneratorSpi /// {@link KeyPairGeneratorSpi#initialize( /// java.security.spec.AlgorithmParameterSpec, /// java.security.SecureRandom) initialize} method, /// passing it {@code params} and a source of randomness (obtained /// from the highest-priority installed provider or system-provided if none /// of the installed providers supply one). /// That {@code initialize} method always throws an /// UnsupportedOperationException if it is not overridden by the provider. /// /// </para> /// </summary> /// <param name="params"> the parameter set used to generate the keys. /// </param> /// <exception cref="InvalidAlgorithmParameterException"> if the given parameters /// are inappropriate for this key pair generator. /// /// @since 1.2 </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void initialize(java.security.spec.AlgorithmParameterSpec params) throws InvalidAlgorithmParameterException public virtual void Initialize(AlgorithmParameterSpec @params) { Initialize(@params, JCAUtil.SecureRandom); }
public override void Initialize (AlgorithmParameterSpec pars) { pspec = (DHParameterSpec) pars; }
/// <summary> /// Initializes this parameters object using the parameters /// specified in {@code paramSpec}. /// </summary> /// <param name="paramSpec"> the parameter specification. /// </param> /// <exception cref="InvalidParameterSpecException"> if the given parameter /// specification is inappropriate for the initialization of this parameter /// object. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected abstract void engineInit(java.security.spec.AlgorithmParameterSpec paramSpec) throws java.security.spec.InvalidParameterSpecException; protected internal abstract void EngineInit(AlgorithmParameterSpec paramSpec);
/// <summary> /// Initializes the key pair generator using the specified parameter /// set and user-provided source of randomness. /// /// <para>This concrete method has been added to this previously-defined /// abstract class. (For backwards compatibility, it cannot be abstract.) /// It may be overridden by a provider to initialize the key pair /// generator. Such an override /// is expected to throw an InvalidAlgorithmParameterException if /// a parameter is inappropriate for this key pair generator. /// If this method is not overridden, it always throws an /// UnsupportedOperationException. /// /// </para> /// </summary> /// <param name="params"> the parameter set used to generate the keys. /// </param> /// <param name="random"> the source of randomness for this generator. /// </param> /// <exception cref="InvalidAlgorithmParameterException"> if the given parameters /// are inappropriate for this key pair generator. /// /// @since 1.2 </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void initialize(java.security.spec.AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException public virtual void Initialize(AlgorithmParameterSpec @params, SecureRandom random) { throw new UnsupportedOperationException(); }
/// <summary> /// <para>This method is overridden by providers to initialize /// this signature engine with the specified parameter set. /// /// </para> /// </summary> /// <param name="params"> the parameters /// </param> /// <exception cref="UnsupportedOperationException"> if this method is not /// overridden by a provider /// </exception> /// <exception cref="InvalidAlgorithmParameterException"> if this method is /// overridden by a provider and the given parameters /// are inappropriate for this signature engine </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected void engineSetParameter(java.security.spec.AlgorithmParameterSpec params) throws InvalidAlgorithmParameterException protected internal virtual void EngineSetParameter(AlgorithmParameterSpec @params) { throw new UnsupportedOperationException(); }
public override void Initialize(AlgorithmParameterSpec pars) { pspec = (DHParameterSpec)pars; }
public virtual void Initialize(AlgorithmParameterSpec pars) { throw new NotSupportedException(); }
/// <summary> /// Initializes this parameter generator with a set of algorithm-specific /// parameter generation values. /// To generate the parameters, the {@code SecureRandom} /// implementation of the highest-priority installed provider is used as /// the source of randomness. /// (If none of the installed providers supply an implementation of /// {@code SecureRandom}, a system-provided source of randomness is /// used.) /// </summary> /// <param name="genParamSpec"> the set of algorithm-specific parameter generation values. /// </param> /// <exception cref="InvalidAlgorithmParameterException"> if the given parameter /// generation values are inappropriate for this parameter generator. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public final void init(java.security.spec.AlgorithmParameterSpec genParamSpec) throws InvalidAlgorithmParameterException public void Init(AlgorithmParameterSpec genParamSpec) { ParamGenSpi.EngineInit(genParamSpec, new SecureRandom()); }