Esempio n. 1
0
        public static RSAKeyEncoded KeyEncode(RSAParameters key, ByteEncodeMethod byteEncodeMethod)
        {
            RSAKeyEncoded rsakeyEncoded = new RSAKeyEncoded(byteEncodeMethod);

            rsakeyEncoded.FromRSAParameters(key);
            return(rsakeyEncoded);
        }
Esempio n. 2
0
        public static string Decrypt(RSAKeyEncoded encodedKey, string encryptedText, ByteEncodeMethod ByteEncode, Encoding TextEncode)
        {
            RSAParameters key = encodedKey.ToRSAParameters();

            byte[] encryptedText2 = ByteArrayEncoder.Decode(encryptedText, ByteEncode);
            byte[] bytes          = RSASimpleWrapper.Decrypt(key, encryptedText2);
            return(TextEncode.GetString(bytes));
        }
Esempio n. 3
0
        public static string Encrypt(RSAKeyEncoded encodedKey, string plainText, ByteEncodeMethod ByteEncode, Encoding TextEncode)
        {
            RSAParameters key = encodedKey.ToRSAParameters();

            byte[] bytes     = TextEncode.GetBytes(plainText);
            byte[] byteArray = RSASimpleWrapper.Encrypt(key, bytes);
            return(ByteArrayEncoder.Encode(byteArray, ByteEncode));
        }
Esempio n. 4
0
 public static RSAParameters KeyDecode(RSAKeyEncoded encoded, ByteEncodeMethod byteEncodeMethod)
 {
     return(encoded.ToRSAParameters(byteEncodeMethod));
 }