コード例 #1
0
ファイル: RSASimpleWrapper.cs プロジェクト: ratiel/Vindictus
        public static RSAKeyEncoded KeyEncode(RSAParameters key, ByteEncodeMethod byteEncodeMethod)
        {
            RSAKeyEncoded rsakeyEncoded = new RSAKeyEncoded(byteEncodeMethod);

            rsakeyEncoded.FromRSAParameters(key);
            return(rsakeyEncoded);
        }
コード例 #2
0
ファイル: RSASimpleWrapper.cs プロジェクト: ratiel/Vindictus
        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
ファイル: RSASimpleWrapper.cs プロジェクト: ratiel/Vindictus
        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
ファイル: RSASimpleWrapper.cs プロジェクト: ratiel/Vindictus
 public static RSAParameters KeyDecode(RSAKeyEncoded encoded, ByteEncodeMethod byteEncodeMethod)
 {
     return(encoded.ToRSAParameters(byteEncodeMethod));
 }