using System; using System.Runtime.InteropServices; using Mono.Security.Cryptography; namespace System.Security.Cryptography { /// Creates the PKCS#1 key exchange data using . // Token: 0x02000520 RID: 1312 [ComVisible(true)] public class RSAPKCS1KeyExchangeFormatter : AsymmetricKeyExchangeFormatter { /// Initializes a new instance of the class. // Token: 0x06003048 RID: 12360 RVA: 0x0009DEA0 File Offset: 0x0009C0A0 public RSAPKCS1KeyExchangeFormatter() { } /// Initializes a new instance of the class with the specified key. /// The instance of the algorithm that holds the public key. /// /// is null. // Token: 0x06003049 RID: 12361 RVA: 0x0009DEA8 File Offset: 0x0009C0A8 public RSAPKCS1KeyExchangeFormatter(AsymmetricAlgorithm key) { this.SetRSAKey(key); } /// 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: 0x17000982 RID: 2434 // (get) Token: 0x0600304A RID: 12362 RVA: 0x0009DEB8 File Offset: 0x0009C0B8 // (set) Token: 0x0600304B RID: 12363 RVA: 0x0009DEC0 File Offset: 0x0009C0C0 public RandomNumberGenerator Rng { get { return this.random; } set { this.random = value; } } /// Gets the parameters for the PKCS #1 key exchange. /// An XML string containing the parameters of the PKCS #1 key exchange operation. // Token: 0x17000983 RID: 2435 // (get) Token: 0x0600304C RID: 12364 RVA: 0x0009DECC File Offset: 0x0009C0CC public override string Parameters { get { return ""; } } /// 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. /// /// is too big. /// The key is null. /// /// /// // Token: 0x0600304D RID: 12365 RVA: 0x0009DED4 File Offset: 0x0009C0D4 public override byte[] CreateKeyExchange(byte[] rgbData) { if (rgbData == null) { throw new ArgumentNullException("rgbData"); } if (this.rsa == null) { string text = Locale.GetText("No RSA key specified"); throw new CryptographicUnexpectedOperationException(text); } if (this.random == null) { this.random = RandomNumberGenerator.Create(); } return PKCS1.Encrypt_v15(this.rsa, 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: 0x0600304E RID: 12366 RVA: 0x0009DF38 File Offset: 0x0009C138 public override byte[] CreateKeyExchange(byte[] rgbData, Type symAlgType) { return this.CreateKeyExchange(rgbData); } // Token: 0x0600304F RID: 12367 RVA: 0x0009DF44 File Offset: 0x0009C144 private void SetRSAKey(AsymmetricAlgorithm key) { if (key == null) { throw new ArgumentNullException("key"); } this.rsa = (RSA)key; } /// 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: 0x06003050 RID: 12368 RVA: 0x0009DF64 File Offset: 0x0009C164 public override void SetKey(AsymmetricAlgorithm key) { this.SetRSAKey(key); } // Token: 0x040013A1 RID: 5025 private RSA rsa; // Token: 0x040013A2 RID: 5026 private RandomNumberGenerator random; } }