public static byte[] HybridDecrypt
(
X509Certificate2 decryptorPrivateKeyPfx
, Secret data
)
{
X509Certificate2 encryptorPublicKeyCer = null;
try
{
RSACryptoServiceProvider decryptorPrivateKeyPfxProvider = decryptorPrivateKeyPfx.PrivateKey as RSACryptoServiceProvider;
encryptorPublicKeyCer = new X509Certificate2(data.EncryptorPublicKeyCerRawData);
RSACryptoServiceProvider encryptorPublicKeyCerProvider = encryptorPublicKeyCer.PublicKey.Key as RSACryptoServiceProvider;
return HybridDecrypt
(
decryptorPrivateKeyPfxProvider
, encryptorPublicKeyCerProvider
, data
);
}
catch
{
return null;
}
finally
{
if (encryptorPublicKeyCer != null)
{
encryptorPublicKeyCer.Reset();
}
}
}