Esempio n. 1
0
 /// <summary>
 /// Calls DH_generate_parameters_ex()
 /// </summary>
 /// <param name="primeLen"></param>
 /// <param name="generator"></param>
 /// <param name="callback"></param>
 /// <param name="arg"></param>
 public DH(int primeLen, int generator, BigNumber.GeneratorHandler callback, object arg)
     : base(Native.ExpectNonNull(Native.DH_new()), true)
 {
     this.thunk = new BigNumber.GeneratorThunk(callback, arg);
     Native.ExpectSuccess(Native.DH_generate_parameters_ex(
                              this.ptr,
                              primeLen,
                              generator,
                              this.thunk.CallbackStruct)
                          );
 }
Esempio n. 2
0
File: DSA.cs Progetto: wlasser/D3Emu
 /// <summary>
 /// Calls DSA_new() then DSA_generate_parameters_ex()
 /// </summary>
 /// <param name="bits"></param>
 /// <param name="callback"></param>
 /// <param name="arg"></param>
 public DSA(int bits, BigNumber.GeneratorHandler callback, object arg)
     : base(Native.ExpectNonNull(Native.DSA_new()), true)
 {
     this.thunk = new BigNumber.GeneratorThunk(callback, arg);
     Native.ExpectSuccess(Native.DSA_generate_parameters_ex(
                              this.ptr,
                              bits,
                              null, 0,
                              out this.counter,
                              out this.h,
                              this.thunk.CallbackStruct)
                          );
 }
Esempio n. 3
0
        /// <summary>
        /// Calls DSA_new() then DSA_generate_parameters_ex()
        /// </summary>
        /// <param name="bits"></param>
        /// <param name="seed"></param>
        /// <param name="counter"></param>
        /// <param name="callback"></param>
        /// <param name="arg"></param>
        public DSA(int bits, byte[] seed, int counter, BigNumber.GeneratorHandler callback, object arg)
            : base(Native.ExpectNonNull(Native.DSA_new()), true)
        {
            this.counter = counter;
            thunk        = new BigNumber.GeneratorThunk(callback, arg);

            Native.ExpectSuccess(Native.DSA_generate_parameters_ex(
                                     ptr,
                                     bits,
                                     seed, seed.Length,
                                     out this.counter,
                                     out h,
                                     thunk.CallbackStruct)
                                 );
        }
Esempio n. 4
0
 /// <summary>
 /// Calls RSA_generate_key_ex()
 /// </summary>
 /// <param name="bits"></param>
 /// <param name="e"></param>
 /// <param name="callback"></param>
 /// <param name="arg"></param>
 public void GenerateKeys(int bits, BigNumber e, BigNumber.GeneratorHandler callback, object arg)
 {
     thunk = new BigNumber.GeneratorThunk(callback, arg);
     Native.ExpectSuccess(Native.RSA_generate_key_ex(ptr, bits, e.Handle, thunk.CallbackStruct));
 }
Esempio n. 5
0
		/// <summary>
		/// Calls DSA_new() then DSA_generate_parameters_ex()
		/// </summary>
		/// <param name="bits"></param>
		/// <param name="seed"></param>
		/// <param name="counter"></param>
		/// <param name="callback"></param>
		/// <param name="arg"></param>
		public DSA(int bits, byte[] seed, int counter, BigNumber.GeneratorHandler callback, object arg)
			: base(Native.ExpectNonNull(Native.DSA_new()), true)
		{
			this.counter = counter;
			this.thunk = new BigNumber.GeneratorThunk(callback, arg);
			Native.ExpectSuccess(Native.DSA_generate_parameters_ex(
				this.ptr,
				bits,
				seed, seed.Length,
				out this.counter,
				out this.h,
				this.thunk.CallbackStruct)
			);
		}
Esempio n. 6
0
		/// <summary>
		/// Calls DSA_new() then DSA_generate_parameters_ex()
		/// </summary>
		/// <param name="bits"></param>
		/// <param name="callback"></param>
		/// <param name="arg"></param>
		public DSA(int bits, BigNumber.GeneratorHandler callback, object arg)
			: base(Native.ExpectNonNull(Native.DSA_new()), true)
		{
			thunk = new BigNumber.GeneratorThunk(callback, arg);

			Native.ExpectSuccess(Native.DSA_generate_parameters_ex(
				ptr,
				bits,
				null, 0,
				out counter,
				out h,
				thunk.CallbackStruct)
			);
		}
Esempio n. 7
0
		/// <summary>
		/// Calls DH_generate_parameters_ex()
		/// </summary>
		/// <param name="primeLen"></param>
		/// <param name="generator"></param>
		/// <param name="callback"></param>
		/// <param name="arg"></param>
		public DH(int primeLen, int generator, BigNumber.GeneratorHandler callback, object arg)
			: base(Native.ExpectNonNull(Native.DH_new()), true)
		{
			thunk = new BigNumber.GeneratorThunk(callback, arg);
			Native.ExpectSuccess(Native.DH_generate_parameters_ex(
				ptr,
				primeLen,
				generator,
				thunk.CallbackStruct)
			);
		}
Esempio n. 8
0
		/// <summary>
		/// Calls RSA_generate_key_ex()
		/// </summary>
		/// <param name="bits"></param>
		/// <param name="e"></param>
		/// <param name="callback"></param>
		/// <param name="arg"></param>
		public void GenerateKeys(int bits, BigNumber e, BigNumber.GeneratorHandler callback, object arg)
		{
			thunk = new BigNumber.GeneratorThunk(callback, arg);
			Native.ExpectSuccess(Native.RSA_generate_key_ex(ptr, bits, e.Handle, thunk.CallbackStruct));
		}