Esempio n. 1
0
 /// <inheritdoc />
 protected internal override bool VerifySignature(byte[] data, byte[] signature)
 {
     using (var hasher = CryptographicEngine.GetHashAlgorithm(this.Algorithm))
     {
         byte[] hash = hasher.ComputeHash(data);
         return(this.VerifyHash(hash, signature));
     }
 }
Esempio n. 2
0
 /// <inheritdoc />
 protected internal override byte[] Sign(byte[] data)
 {
     using (var hasher = CryptographicEngine.GetHashAlgorithm(this.Algorithm))
     {
         byte[] hash = hasher.ComputeHash(data);
         return(this.SignHash(hash));
     }
 }
Esempio n. 3
0
 /// <inheritdoc />
 protected internal override byte[] Sign(byte[] data)
 {
     using (var hash = CryptographicEngine.GetHashAlgorithm(this.Algorithm))
     {
         AsymmetricSignatureFormatter formatter = this.GetSignatureFormatter();
         formatter.SetHashAlgorithm(hash.ToString());
         return(formatter.CreateSignature(hash.ComputeHash(data)));
     }
 }
Esempio n. 4
0
 /// <inheritdoc />
 protected internal override bool VerifySignature(byte[] data, byte[] signature)
 {
     using (var hash = CryptographicEngine.GetHashAlgorithm(this.Algorithm))
     {
         var deformatter = this.GetSignatureDeformatter();
         deformatter.SetHashAlgorithm(hash.ToString());
         return(deformatter.VerifySignature(hash.ComputeHash(data), signature));
     }
 }
Esempio n. 5
0
 /// <inheritdoc />
 protected internal override byte[] SignHash(byte[] data)
 {
     using (var hash = CryptographicEngine.GetHashAlgorithm(this.Algorithm))
     {
         var formatter = new RSAPKCS1SignatureFormatter(this.Rsa);
         formatter.SetHashAlgorithm(hash.ToString());
         return(formatter.CreateSignature(data));
     }
 }
Esempio n. 6
0
 /// <inheritdoc />
 protected internal override bool VerifyHash(byte[] data, byte[] signature)
 {
     try
     {
         using (var hash = CryptographicEngine.GetHashAlgorithm(this.Algorithm))
         {
             var deformatter = this.GetSignatureDeformatter();
             deformatter.SetHashAlgorithm(hash.ToString());
             return(deformatter.VerifySignature(data, signature));
         }
     }
     catch (CryptographicException)
     {
         return(false);
     }
 }