using System;
using System.Runtime.InteropServices;
using Mono.Security.Cryptography;
namespace System.Security.Cryptography
{
/// Verifies an PKCS #1 version 1.5 signature.
// Token: 0x02000521 RID: 1313
[ComVisible(true)]
public class RSAPKCS1SignatureDeformatter : AsymmetricSignatureDeformatter
{
/// Initializes a new instance of the class.
// Token: 0x06003051 RID: 12369 RVA: 0x0009DF70 File Offset: 0x0009C170
public RSAPKCS1SignatureDeformatter()
{
}
/// Initializes a new instance of the class with the specified key.
/// The instance of that holds the public key.
///
/// is null.
// Token: 0x06003052 RID: 12370 RVA: 0x0009DF78 File Offset: 0x0009C178
public RSAPKCS1SignatureDeformatter(AsymmetricAlgorithm key)
{
this.SetKey(key);
}
/// Sets the hash algorithm to use for verifying the signature.
/// The name of the hash algorithm to use for verifying the signature.
// Token: 0x06003053 RID: 12371 RVA: 0x0009DF88 File Offset: 0x0009C188
public override void SetHashAlgorithm(string strName)
{
if (strName == null)
{
throw new ArgumentNullException("strName");
}
this.hashName = strName;
}
/// Sets the public key to use for verifying the signature.
/// The instance of that holds the public key.
///
/// is null.
// Token: 0x06003054 RID: 12372 RVA: 0x0009DFA4 File Offset: 0x0009C1A4
public override void SetKey(AsymmetricAlgorithm key)
{
if (key == null)
{
throw new ArgumentNullException("key");
}
this.rsa = (RSA)key;
}
/// Verifies the PKCS#1 signature for the specified data.
/// true if matches the signature computed using the specified hash algorithm and key on ; otherwise, false.
/// The data signed with .
/// The signature to be verified for .
/// The key is null.-or- The hash algorithm is null.
/// The parameter is null.-or- The parameter is null.
///
///
///
// Token: 0x06003055 RID: 12373 RVA: 0x0009DFC4 File Offset: 0x0009C1C4
public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature)
{
if (this.rsa == null)
{
throw new CryptographicUnexpectedOperationException(Locale.GetText("No public key available."));
}
if (this.hashName == null)
{
throw new CryptographicUnexpectedOperationException(Locale.GetText("Missing hash algorithm."));
}
if (rgbHash == null)
{
throw new ArgumentNullException("rgbHash");
}
if (rgbSignature == null)
{
throw new ArgumentNullException("rgbSignature");
}
return PKCS1.Verify_v15(this.rsa, HashAlgorithm.Create(this.hashName), rgbHash, rgbSignature);
}
// Token: 0x040013A3 RID: 5027
private RSA rsa;
// Token: 0x040013A4 RID: 5028
private string hashName;
}
}