示例#1
0
        public static RSAKeyEncoded KeyEncode(RSAParameters key, ByteEncodeMethod byteEncodeMethod)
        {
            RSAKeyEncoded rsakeyEncoded = new RSAKeyEncoded(byteEncodeMethod);

            rsakeyEncoded.FromRSAParameters(key);
            return(rsakeyEncoded);
        }
示例#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));
        }
示例#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));
        }
示例#4
0
 public static RSAParameters KeyDecode(RSAKeyEncoded encoded, ByteEncodeMethod byteEncodeMethod)
 {
     return(encoded.ToRSAParameters(byteEncodeMethod));
 }