/// Encrypts the given [data] with RSA using the specified [key]. public static byte[] encryptBytesWithRsa(byte[] data, PublicKey key) { RSAcoder coder = new RSAcoder((AsymmetricKeyParameter)((RSAPublicKey)key).pubKey); return(coder.Encrypt(data)); }
/// Encrypts the given [data] with RSA using the specified [key]. public static byte[] encryptStringWithRsa(String data, PublicKey key) { RSAcoder coder = new RSAcoder((AsymmetricKeyParameter)((RSAPublicKey)key).pubKey); return(coder.Encrypt(System.Text.Encoding.UTF8.GetBytes(data))); }