This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void Main() | |
{ | |
var privateKey = "your privateKey string"; | |
privateKey = $"-----BEGIN RSA PRIVATE KEY-----{Environment.NewLine}{privateKey}{Environment.NewLine}-----END RSA PRIVATE KEY-----"; | |
var key = "your key need to be decrypt"; | |
var rsa = RSA.Create(); | |
rsa.ImportFromPem(privateKey.ToCharArray()); | |
var decryptedBytes = rsa.Decrypt( | |
Convert.FromBase64String(key), | |
RSAEncryptionPadding.Pkcs1 |