Пример #1
0
        /// <summary>Force a reseed of the DRBG.</summary>
        /// <param name="additionalInput">optional additional input</param>
        public virtual void Reseed(byte[] additionalInput)
        {
            lock (this)
            {
                if (mDrbg == null)
                {
                    mDrbg = mDrbgProvider.Get(mEntropySource);
                }

                mDrbg.Reseed(additionalInput);
            }
        }
Пример #2
0
 public override void NextBytes(byte[] bytes)
 {
     lock (this)
     {
         if (mDrbg == null)
         {
             mDrbg = mDrbgProvider.Get(mEntropySource);
         }
         if (mDrbg.Generate(bytes, null, mPredictionResistant) < 0)
         {
             mDrbg.Reseed(null);
             mDrbg.Generate(bytes, null, mPredictionResistant);
         }
     }
 }
Пример #3
0
        public override void NextBytes(byte[] bytes)
        {
            lock (this)
            {
                if (mDrbg == null)
                {
                    mDrbg = mDrbgProvider.Get(mEntropySource);
                }

                // check if a reseed is required...
                if (mDrbg.Generate(bytes, null, mPredictionResistant) < 0)
                {
                    mDrbg.Reseed(null);
                    mDrbg.Generate(bytes, null, mPredictionResistant);
                }
            }
        }