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 Bouncy Castle,当我使用以下代码使用加密文本和私钥解密时:
keyPair = (AsymmetricCipherKeyPair)new PemReader(reader).ReadObject();
IAsymmetricBlockCipher cipher = new RsaEngine();
RsaKeyParameters privateKey = (RsaKeyParameters)keyPair.Private;
cipher.Init(false, keyPair.Private);
byte[] deciphered = cipher.ProcessBlock(bytesl, 0, bytesl.Length);
string decipheredText = utf8enc.GetString(deciphered);
我得到 decipheredText 为
☻♣?????U??`?u????|???^H?|???☺????♦M>?→?&↔.0p?J??a?▼?S←$*▬T☼? xQ??-??Ai9;??siqD??_??? ♥↓§?k?Ny??kr?U??↔z Mazher Ul Haq
但我的实际字符串是“Mazher Ul Haq”,如何获取实际字符串