I am trying to decrypt the data using private key. I was able to decrypt the key using RSA and private key. Now I would like to decrypt the data using the decrypted key. The data was encrypted the values using AES and random session secret using PHP. Could you please let me know if there are any examples?
这里是我迄今为止制定的准则。
static void Main(string[] args)
{
AsymmetricCipherKeyPair keyPair;
string protectedSecret = "U6XksFkhWV4.......eo3fRg==";
var decodedSecret = Convert.FromBase64String(protectedSecret);
string iv = "KLnP....wA==";
var decodedIV = Convert.FromBase64String(iv);
using (var reader = File.OpenText(@"c:\private.key"))
keyPair = (AsymmetricCipherKeyPair)new PemReader(reader).ReadObject();
var decryptPKIEngine = new Pkcs1Encoding(new RsaEngine());
decryptPKIEngine.Init(false, keyPair.Private);
var secret = Encoding.UTF8.GetString(decryptPKIEngine.ProcessBlock(decodedSecret, 0, decodedSecret.Length));
var protectedData = Convert.FromBase64String("f8..Po=");
}