Example #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);
            }
        }
 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);
         }
     }
 }
        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);
                }
            }
        }