public void EncryptFile(RsaAesDecryptor decryptor, string file, string encryptedFile) { AesEncryption aes = new AesEncryption(); RsaEncryption rsa = new RsaEncryption(); _aesEncryptedKey = rsa.Encrypt(aes.Key, decryptor.PublicKey); _aesEncryptedIV = rsa.Encrypt(aes.IV, decryptor.PublicKey); File.Delete(encryptedFile); aes.EncryptFile(file, encryptedFile); }
public byte[] Encrypt(byte[] bytes, string receiverPublicKey) { if (bytes == null) { bytes = new byte[0]; } RsaEncryption rsa = new RsaEncryption(this._rsa.KeySize, receiverPublicKey); return(rsa.Encrypt(bytes)); }
public byte[] Encrypt(string str, string receiverPublicKey) { if (str == null) { str = ""; } RsaEncryption rsa = new RsaEncryption(this._rsa.KeySize, receiverPublicKey); return(rsa.Encrypt(System.Text.Encoding.Unicode.GetBytes(str))); }