83 lines
3.5 KiB
C#
83 lines
3.5 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using Mono.Security.Cryptography;
|
|
|
|
namespace System.Security.Cryptography
|
|
{
|
|
/// <summary>Decrypts Optimal Asymmetric Encryption Padding (OAEP) key exchange data.</summary>
|
|
// Token: 0x0200051D RID: 1309
|
|
[ComVisible(true)]
|
|
public class RSAOAEPKeyExchangeDeformatter : AsymmetricKeyExchangeDeformatter
|
|
{
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter" /> class.</summary>
|
|
// Token: 0x06003030 RID: 12336 RVA: 0x0009DCC4 File Offset: 0x0009BEC4
|
|
public RSAOAEPKeyExchangeDeformatter()
|
|
{
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter" /> class with the specified key.</summary>
|
|
/// <param name="key">The instance of the <see cref="T:System.Security.Cryptography.RSA" /> algorithm that holds the private key. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="key " />is null.</exception>
|
|
// Token: 0x06003031 RID: 12337 RVA: 0x0009DCCC File Offset: 0x0009BECC
|
|
public RSAOAEPKeyExchangeDeformatter(AsymmetricAlgorithm key)
|
|
{
|
|
this.SetKey(key);
|
|
}
|
|
|
|
/// <summary>Gets the parameters for the Optimal Asymmetric Encryption Padding (OAEP) key exchange.</summary>
|
|
/// <returns>An XML string containing the parameters of the OAEP key exchange operation.</returns>
|
|
// Token: 0x1700097C RID: 2428
|
|
// (get) Token: 0x06003032 RID: 12338 RVA: 0x0009DCDC File Offset: 0x0009BEDC
|
|
// (set) Token: 0x06003033 RID: 12339 RVA: 0x0009DCE0 File Offset: 0x0009BEE0
|
|
public override string Parameters
|
|
{
|
|
get
|
|
{
|
|
return null;
|
|
}
|
|
set
|
|
{
|
|
}
|
|
}
|
|
|
|
/// <summary>Extracts secret information from the encrypted key exchange data.</summary>
|
|
/// <returns>The secret information derived from the key exchange data.</returns>
|
|
/// <param name="rgbData">The key exchange data within which the secret information is hidden. </param>
|
|
/// <exception cref="T:System.Security.Cryptography.CryptographicException">The key exchange data verification has failed. </exception>
|
|
/// <exception cref="T:System.Security.Cryptography.CryptographicUnexpectedOperationException">The key is missing.</exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06003034 RID: 12340 RVA: 0x0009DCE4 File Offset: 0x0009BEE4
|
|
public override byte[] DecryptKeyExchange(byte[] rgbData)
|
|
{
|
|
if (this.rsa == null)
|
|
{
|
|
string text = Locale.GetText("No RSA key specified");
|
|
throw new CryptographicUnexpectedOperationException(text);
|
|
}
|
|
SHA1 sha = SHA1.Create();
|
|
byte[] array = PKCS1.Decrypt_OAEP(this.rsa, sha, rgbData);
|
|
if (array != null)
|
|
{
|
|
return array;
|
|
}
|
|
throw new CryptographicException(Locale.GetText("OAEP decoding error."));
|
|
}
|
|
|
|
/// <summary>Sets the private key to use for decrypting the secret information.</summary>
|
|
/// <param name="key">The instance of the <see cref="T:System.Security.Cryptography.RSA" /> algorithm that holds the private key. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="key" /> is null.</exception>
|
|
// Token: 0x06003035 RID: 12341 RVA: 0x0009DD3C File Offset: 0x0009BF3C
|
|
public override void SetKey(AsymmetricAlgorithm key)
|
|
{
|
|
this.rsa = (RSA)key;
|
|
}
|
|
|
|
// Token: 0x0400139B RID: 5019
|
|
private RSA rsa;
|
|
}
|
|
}
|