Exemplo n.º 1
0
 /// <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);
 }
Exemplo n.º 2
0
 /// <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);
 }
Exemplo n.º 3
0
 /// <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;
 }
Exemplo n.º 4
0
 /// <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);
 }
Exemplo n.º 5
0
 /// <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);
 }
Exemplo n.º 6
0
 /// <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);
 }
Exemplo n.º 7
0
 /// <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);
 }