使用Crypto++加密,使用Python.CRYPT

2024-09-28 23:19:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在做一个项目,它使用Crypto++加密一些使用RSA的数据。在

下面是我的Crypto++代码:

string plain = "Text123", encoded, cipher;
string pkey = "...";

StringSource ss1(pkey, true);
RSA::PublicKey publicKey;
PEM_Load(ss, publicKey);
RSAES_OAEP_SHA_Encryptor e(publicKey);

StringSource ss2(plain, true,
    new PK_EncryptorFilter(prng, e,
        new StringSink(cipher)
    ) 
); 

StringSource ss3(cipher, true,
    new Base64Encoder(
        new StringSink(encoded)
    )
);
cout << encoded;

我正在尝试用Python解密加密的消息。下面是我的Python代码:

^{pr2}$

但我得到了不可读的角色。在

为什么我得到了不可读的字符?有人能帮我吗?在

提前谢谢。在


Tags: 数据项目代码truenewstringcryptorsa