Esempio n. 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));
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CMACGrasshopper"/> class.
 /// </summary>
 public CMACGrasshopper()
     : this(CryptoUtils.GenerateRandomBytes(32))
 {
 }
Esempio n. 3
0
 /// <summary>
 /// Generates a random key to be used for the algorithm.
 /// </summary>
 public override void GenerateKey()
 {
     KeyValue = CryptoUtils.GenerateRandomBytes(KeySizeValue / 8);
 }
Esempio n. 4
0
 /// <summary>
 /// Generates a random initialization vector to be used for the algorithm.
 /// </summary>
 public override void GenerateIV()
 {
     IVValue = CryptoUtils.GenerateRandomBytes(FeedbackSizeValue / 8);
 }
Esempio n. 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))
 {
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CMACMagma"/> class.
 /// </summary>
 public CMACMagma()
     : this(CryptoUtils.GenerateRandomBytes(32))
 {
 }