Ejemplo n.º 1
0
        /// 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));
        }
Ejemplo n.º 2
0
        /// 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)));
        }