Exemple #1
0
 public void Decrypt(SecureString privatekey, string publickey)
 {
     if (!Security.Utils.IsBase64(privatekey))
     {
         throw new ArgumentException($"{nameof(privatekey)} must be Base64-encoded string");
     }
     if (!Security.Utils.IsBase64(publickey))
     {
         throw new ArgumentException($"{nameof(publickey)} must be Base64-encoded string");
     }
     using SecureString key = Security.Boxes.Asymmetric.Decrypt(EncryptedKey.Split(':')[1], privatekey, publickey, EncryptedKey.Split(':')[0]);
     Plaintext = Security.Boxes.Symmetric.Decrypt(EncryptedMessage, key, Nonce);
 }