Ejemplo n.º 1
0
 public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature)
 {
     if (rgbHash == null)
     {
         throw new ArgumentNullException("rgbHash");
     }
     if (rgbSignature == null)
     {
         throw new ArgumentNullException("rgbSignature");
     }
     if (this._strOID == null)
     {
         throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingOID"));
     }
     if (this._rsaKey == null)
     {
         throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey"));
     }
     if (this._rsaKey is RSACryptoServiceProvider)
     {
         int calgHash = X509Utils.OidToAlgIdStrict(this._strOID, OidGroup.HashAlgorithm);
         return(((RSACryptoServiceProvider)this._rsaKey).VerifyHash(rgbHash, calgHash, rgbSignature));
     }
     byte[] rhs = Utils.RsaPkcs1Padding(this._rsaKey, CryptoConfig.EncodeOID(this._strOID), rgbHash);
     return(Utils.CompareBigIntArrays(this._rsaKey.EncryptValue(rgbSignature), rhs));
 }