我有一个程序需要使用RSA私钥解密3个短语,但一直显示上述异常:System.Security.Cryptography.CryptographicException: 'Cryptography_OAEPDecoding'。为了让它正常工作,我需要改变什么?我尝试查看其他页面,但太混乱了,最终只能添加太多被注释的代码并重新开始。
弹出的异常
// Your current statement:
var decryptedBytes = rsa.Decrypt(resultBytes, true);
// fOAEP:
// true to perform direct System.Security.Cryptography.RSA decryption using
// OAEP padding (only available on a computer running Microsoft Windows XP or
// later); otherwise, false to use PKCS#1 v1.5 padding.
var decryptedBytes = rsa.Decrypt(resultBytes, false);
INICIO DE LA SEGUNDA PARTE
M A N D A C O R R E O A J A V I E R B E L
C O N T U N O M B R E C O M P L E T O
Y L A F E C H A / H O R A
重要提示:
可能是由于复制/粘贴时,您的base64密文不正确。我进行了如下更正:
var FRASE1 = "IlmhPFKroDuK4AUtBGfaf5J6791DzMenkUBEXfRwZ7rmBHswHTf02LAba/Hs+rsh3wL6dpMQlEhlaIAVHaZZsw==";
var FRASE2 = "AMbsYR1pq9WYUj3mdqKvJj7tMznqBAcZLxM2C6WzNEUOqKD/qdEE76bNJPmYFKwVei2rhuHFsxh7nUzXmVKRdw==";
var FRASE3 = "J1jnq551phV+W4MVzE5caXIHqM3E0gz/t9PVtorqvDVqfne8CCF9UQiEk33Rssi1IEz6JH8Fd8ZAvnX3UWe5Vw==";