public static RSAKeyEncoded KeyEncode(RSAParameters key, ByteEncodeMethod byteEncodeMethod) { RSAKeyEncoded rsakeyEncoded = new RSAKeyEncoded(byteEncodeMethod); rsakeyEncoded.FromRSAParameters(key); return(rsakeyEncoded); }
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)); }
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)); }
public static RSAParameters KeyDecode(RSAKeyEncoded encoded, ByteEncodeMethod byteEncodeMethod) { return(encoded.ToRSAParameters(byteEncodeMethod)); }