using System; using System.Runtime.InteropServices; using Mono.Security.Cryptography; namespace System.Security.Cryptography { /// Creates an PKCS #1 version 1.5 signature. // Token: 0x02000522 RID: 1314 [ComVisible(true)] public class RSAPKCS1SignatureFormatter : AsymmetricSignatureFormatter { /// Initializes a new instance of the class. // Token: 0x06003056 RID: 12374 RVA: 0x0009E044 File Offset: 0x0009C244 public RSAPKCS1SignatureFormatter() { } /// Initializes a new instance of the class with the specified key. /// The instance of the algorithm that holds the private key. /// /// is null. // Token: 0x06003057 RID: 12375 RVA: 0x0009E04C File Offset: 0x0009C24C public RSAPKCS1SignatureFormatter(AsymmetricAlgorithm key) { this.SetKey(key); } /// Creates the PKCS #1 signature for the specified data. /// The digital signature for . /// The data to be signed. /// The key is null.-or- The hash algorithm is null. /// The parameter is null. /// /// /// // Token: 0x06003058 RID: 12376 RVA: 0x0009E05C File Offset: 0x0009C25C public override byte[] CreateSignature(byte[] rgbHash) { if (this.rsa == null) { throw new CryptographicUnexpectedOperationException(Locale.GetText("No key pair available.")); } if (this.hash == null) { throw new CryptographicUnexpectedOperationException(Locale.GetText("Missing hash algorithm.")); } if (rgbHash == null) { throw new ArgumentNullException("rgbHash"); } return PKCS1.Sign_v15(this.rsa, this.hash, rgbHash); } /// Sets the hash algorithm to use for creating the signature. /// The name of the hash algorithm to use for creating the signature. // Token: 0x06003059 RID: 12377 RVA: 0x0009E0C4 File Offset: 0x0009C2C4 public override void SetHashAlgorithm(string strName) { this.hash = HashAlgorithm.Create(strName); } /// Sets the private key to use for creating the signature. /// The instance of the algorithm that holds the private key. /// /// is null. // Token: 0x0600305A RID: 12378 RVA: 0x0009E0D4 File Offset: 0x0009C2D4 public override void SetKey(AsymmetricAlgorithm key) { if (key == null) { throw new ArgumentNullException("key"); } this.rsa = (RSA)key; } // Token: 0x040013A5 RID: 5029 private RSA rsa; // Token: 0x040013A6 RID: 5030 private HashAlgorithm hash; } }