/// <summary> /// Decrypt the specified str using the specified keys. /// </summary> /// <param name="str">String.</param> /// <param name="keys">Keys.</param> public static string Decrypt(string str, KeyPair keys) { if (!keys.HasPrivateKey) throw new Exception ("The KeyPair doesn't contain a private key."); return Decrypt (str, keys.PrivateKey); }
/// <summary> /// Decrypt the specified data using the specified keys. /// </summary> /// <param name="data">Data.</param> /// <param name="keys">Keys.</param> public static byte[] Decrypt(byte[] data, KeyPair keys) { if (!keys.HasPrivateKey) throw new Exception ("This KeyPair doesn't contain a private key."); return Decrypt (data, keys.PrivateKey); }
/// <summary> /// Initializes a new instance of the <see cref="RSA"/> class. /// </summary> /// <param name="keyPair">Key pair.</param> public RSA(KeyPair keyPair) { this.keyPair = keyPair; }
/// <summary> /// Initializes a new instance of the <see cref="RSA"/> class. /// </summary> /// <param name="publicKey">Public key.</param> /// <param name="privateKey">Private key.</param> public RSA(string publicKey, string privateKey) { keyPair = new KeyPair (publicKey, privateKey); }
/// <summary> /// Initializes a new instance of the <see cref="RSA"/> class. /// </summary> /// <param name="publicKey">Public key.</param> public RSA(string publicKey) { keyPair = new KeyPair (publicKey); }
/// <summary> /// Encrypt the specified data using the specified keys. /// </summary> /// <param name="data">Data.</param> /// <param name="keys">Keys.</param> public static byte[] Encrypt(byte[] data, KeyPair keys) { return Encrypt (data, keys.PublicKey); }
/// <summary> /// Encrypt the specified str using the specified keys. /// </summary> /// <param name="str">String.</param> /// <param name="keys">Keys.</param> public static string Encrypt(string str, KeyPair keys) { return Encrypt (str, keys.PublicKey); }