예제 #1
0
        public virtual void SignAndVerifyHash(ECParameters parameters)
        {
            byte[] hash, signature;
            using (var algorithm = Create(parameters))
            {
                hash      = CryptoUtils.GenerateRandomBytes(algorithm.KeySize / 8);
                signature = algorithm.SignHash(hash);
            }

            Assert.True(VerifyHash(parameters, hash, signature));
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CMACGrasshopper"/> class.
 /// </summary>
 public CMACGrasshopper()
     : this(CryptoUtils.GenerateRandomBytes(32))
 {
 }
예제 #3
0
 /// <summary>
 /// Generates a random key to be used for the algorithm.
 /// </summary>
 public override void GenerateKey()
 {
     KeyValue = CryptoUtils.GenerateRandomBytes(KeySizeValue / 8);
 }
예제 #4
0
 /// <summary>
 /// Generates a random initialization vector to be used for the algorithm.
 /// </summary>
 public override void GenerateIV()
 {
     IVValue = CryptoUtils.GenerateRandomBytes(FeedbackSizeValue / 8);
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HMACStreebog512"/>
 /// class with a randomly generated key.
 /// </summary>
 public HMACStreebog512()
     : this(CryptoUtils.GenerateRandomBytes(64))
 {
 }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CMACMagma"/> class.
 /// </summary>
 public CMACMagma()
     : this(CryptoUtils.GenerateRandomBytes(32))
 {
 }