从 RSA_PublicKey 解析 RSA_PrivateKey

问题描述

我对 botan 库了解不多,我只需要从 Botan::RSA_PublicKey 中获取 Botan::RSA_PrivateKey。这可能吗?

我有一条经过签名的消息,并且消息中也包含了签名。另外,我有 RSA_PublicKey。我的目的是编辑消息并重新创建签名。但我真的不知道如何从公钥创建私钥。代码如下:

 Botan::BigInt n(modulus.data(),modulus.size());
 Botan::BigInt e(exponent.data(),exponent.size());
 Botan::RSA_PublicKey public_key = Botan::RSA_PublicKey(n,e);

 //auto signer = std::make_unique<Botan::PK_Signer>(public_key,"EMSA_PKCS1(SHA-1)"); This doesn't work because I need to create it using a RSA_PrivateKey instead.
 auto verifier = std::make_unique<Botan::PK_Verifier>(public_key,"EMSA_PKCS1(SHA-1)"); // This is the function that I check the validity of the message with its signature.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)