2 // RSAPKCS1SignatureDeformatter.cs - Handles PKCS#1 v.1.5 signature decryption.
5 // Sebastien Pouliot (spouliot@motus.com)
7 // (C) 2002 Motus Technologies Inc. (http://www.motus.com)
12 namespace System.Security.Cryptography {
14 public class RSAPKCS1SignatureDeformatter : AsymmetricSignatureDeformatter {
17 private HashAlgorithm hash;
19 public RSAPKCS1SignatureDeformatter ()
24 public RSAPKCS1SignatureDeformatter (AsymmetricAlgorithm key)
29 public override void SetHashAlgorithm (string strName)
31 hash = HashAlgorithm.Create (strName);
34 public override void SetKey (AsymmetricAlgorithm key)
41 throw new InvalidCastException ();
43 // here null is accepted!
47 public override bool VerifySignature (byte[] rgbHash, byte[] rgbSignature)
49 if ((rsa == null) || (hash == null))
50 throw new CryptographicUnexpectedOperationException ();
51 if ((rgbHash == null) || (rgbSignature == null))
52 throw new ArgumentNullException ();
58 public override bool VerifySignature (HashAlgorithm hash, byte[] rgbSignature)
60 if ((hash == null) || (rgbSignature == null))
61 throw new ArgumentNullException ();
62 if ((rsa == null) || (hash == null))
63 throw new CryptographicUnexpectedOperationException ();