using System;
using System.Runtime.InteropServices;
using Mono.Security.Cryptography;
namespace System.Security.Cryptography
{
/// Creates Optimal Asymmetric Encryption Padding (OAEP) key exchange data using .
// Token: 0x0200051E RID: 1310
[ComVisible(true)]
public class RSAOAEPKeyExchangeFormatter : AsymmetricKeyExchangeFormatter
{
/// Initializes a new instance of the class.
// Token: 0x06003036 RID: 12342 RVA: 0x0009DD4C File Offset: 0x0009BF4C
public RSAOAEPKeyExchangeFormatter()
{
this.rsa = null;
}
/// Initializes a new instance of the class with the specified key.
/// The instance of the algorithm that holds the public key.
///
/// is null.
// Token: 0x06003037 RID: 12343 RVA: 0x0009DD5C File Offset: 0x0009BF5C
public RSAOAEPKeyExchangeFormatter(AsymmetricAlgorithm key)
{
this.SetKey(key);
}
/// Gets or sets the parameter used to create padding in the key exchange creation process.
/// The parameter value.
// Token: 0x1700097D RID: 2429
// (get) Token: 0x06003038 RID: 12344 RVA: 0x0009DD6C File Offset: 0x0009BF6C
// (set) Token: 0x06003039 RID: 12345 RVA: 0x0009DD74 File Offset: 0x0009BF74
public byte[] Parameter
{
get
{
return this.param;
}
set
{
this.param = value;
}
}
/// Gets the parameters for the Optimal Asymmetric Encryption Padding (OAEP) key exchange.
/// An XML string containing the parameters of the OAEP key exchange operation.
// Token: 0x1700097E RID: 2430
// (get) Token: 0x0600303A RID: 12346 RVA: 0x0009DD80 File Offset: 0x0009BF80
public override string Parameters
{
get
{
return null;
}
}
/// Gets or sets the random number generator algorithm to use in the creation of the key exchange.
/// The instance of a random number generator algorithm to use.
// Token: 0x1700097F RID: 2431
// (get) Token: 0x0600303B RID: 12347 RVA: 0x0009DD84 File Offset: 0x0009BF84
// (set) Token: 0x0600303C RID: 12348 RVA: 0x0009DD8C File Offset: 0x0009BF8C
public RandomNumberGenerator Rng
{
get
{
return this.random;
}
set
{
this.random = value;
}
}
/// Creates the encrypted key exchange data from the specified input data.
/// The encrypted key exchange data to be sent to the intended recipient.
/// The secret information to be passed in the key exchange.
/// The key is missing.
///
///
///
// Token: 0x0600303D RID: 12349 RVA: 0x0009DD98 File Offset: 0x0009BF98
public override byte[] CreateKeyExchange(byte[] rgbData)
{
if (this.random == null)
{
this.random = RandomNumberGenerator.Create();
}
if (this.rsa == null)
{
string text = Locale.GetText("No RSA key specified");
throw new CryptographicUnexpectedOperationException(text);
}
SHA1 sha = SHA1.Create();
return PKCS1.Encrypt_OAEP(this.rsa, sha, this.random, rgbData);
}
/// Creates the encrypted key exchange data from the specified input data.
/// The encrypted key exchange data to be sent to the intended recipient.
/// The secret information to be passed in the key exchange.
/// This parameter is not used in the current version.
///
///
///
// Token: 0x0600303E RID: 12350 RVA: 0x0009DDF4 File Offset: 0x0009BFF4
public override byte[] CreateKeyExchange(byte[] rgbData, Type symAlgType)
{
return this.CreateKeyExchange(rgbData);
}
/// Sets the public key to use for encrypting the key exchange data.
/// The instance of the algorithm that holds the public key.
///
/// is null.
// Token: 0x0600303F RID: 12351 RVA: 0x0009DE00 File Offset: 0x0009C000
public override void SetKey(AsymmetricAlgorithm key)
{
this.rsa = (RSA)key;
}
// Token: 0x0400139C RID: 5020
private RSA rsa;
// Token: 0x0400139D RID: 5021
private RandomNumberGenerator random;
// Token: 0x0400139E RID: 5022
private byte[] param;
}
}