scripts
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Mono.Security.Cryptography;
|
||||
|
||||
namespace System.Security.Cryptography
|
||||
{
|
||||
/// <summary>Creates Optimal Asymmetric Encryption Padding (OAEP) key exchange data using <see cref="T:System.Security.Cryptography.RSA" />.</summary>
|
||||
// Token: 0x0200051E RID: 1310
|
||||
[ComVisible(true)]
|
||||
public class RSAOAEPKeyExchangeFormatter : AsymmetricKeyExchangeFormatter
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.RSAOAEPKeyExchangeFormatter" /> class.</summary>
|
||||
// Token: 0x06003036 RID: 12342 RVA: 0x0009DD4C File Offset: 0x0009BF4C
|
||||
public RSAOAEPKeyExchangeFormatter()
|
||||
{
|
||||
this.rsa = null;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.RSAOAEPKeyExchangeFormatter" /> class with the specified key.</summary>
|
||||
/// <param name="key">The instance of the <see cref="T:System.Security.Cryptography.RSA" /> algorithm that holds the public key. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="key " />is null.</exception>
|
||||
// Token: 0x06003037 RID: 12343 RVA: 0x0009DD5C File Offset: 0x0009BF5C
|
||||
public RSAOAEPKeyExchangeFormatter(AsymmetricAlgorithm key)
|
||||
{
|
||||
this.SetKey(key);
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the parameter used to create padding in the key exchange creation process.</summary>
|
||||
/// <returns>The parameter value.</returns>
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <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: 0x1700097E RID: 2430
|
||||
// (get) Token: 0x0600303A RID: 12346 RVA: 0x0009DD80 File Offset: 0x0009BF80
|
||||
public override string Parameters
|
||||
{
|
||||
get
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the random number generator algorithm to use in the creation of the key exchange.</summary>
|
||||
/// <returns>The instance of a random number generator algorithm to use.</returns>
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates the encrypted key exchange data from the specified input data.</summary>
|
||||
/// <returns>The encrypted key exchange data to be sent to the intended recipient.</returns>
|
||||
/// <param name="rgbData">The secret information to be passed in the key exchange. </param>
|
||||
/// <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: 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);
|
||||
}
|
||||
|
||||
/// <summary>Creates the encrypted key exchange data from the specified input data.</summary>
|
||||
/// <returns>The encrypted key exchange data to be sent to the intended recipient.</returns>
|
||||
/// <param name="rgbData">The secret information to be passed in the key exchange. </param>
|
||||
/// <param name="symAlgType">This parameter is not used in the current version. </param>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600303E RID: 12350 RVA: 0x0009DDF4 File Offset: 0x0009BFF4
|
||||
public override byte[] CreateKeyExchange(byte[] rgbData, Type symAlgType)
|
||||
{
|
||||
return this.CreateKeyExchange(rgbData);
|
||||
}
|
||||
|
||||
/// <summary>Sets the public key to use for encrypting the key exchange data.</summary>
|
||||
/// <param name="key">The instance of the <see cref="T:System.Security.Cryptography.RSA" /> algorithm that holds the public key. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="key " />is null.</exception>
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user