I want to get the values to rsaPrivate key, by calling a function.. because I have to use it other places in the main function, but I can't make it work. I have tried with and without pointer to rsaPrivate in the function.
我想通过调用函数来获取rsaPrivate键的值。因为我必须在main函数中的其他地方使用它,但我不能使它工作。我已尝试在函数中使用和不使用指向rsaPrivate的指针。
int main(int argc, char* argv[]) {
CryptoPP::RSA::PrivateKey rsaPrivate;
getKeysFromPfx(&rsaPrivate);
}
void getKeysFromPfx(CryptoPP::RSA::PrivateKey *rsaPrivate) {
try
{
rsaPrivate.BERDecodePrivateKey(queue, false /*paramsPresent*/, queue.MaxRetrievable());
// BERDecodePrivateKey is a void function. Here's the only check
// we have regarding the DER bytes consumed.
assert(queue.IsEmpty());
bool valid = *rsaPrivate.Validate(prng, 3);
if (!valid)
std::cerr << "RSA private key is not valid" << std::endl;
catch (const Exception& ex)
{
std::cerr << ex.what() << std::endl;
exit(1);
}
}
the error is in the function where it says for rsaPrivate
错误发生在它为rsaPrivate所说的函数中
expression must have class type
表达式必须具有类类型
1 个解决方案
#1
0
By the comments of this question, here is the solution.
通过这个问题的评论,这是解决方案。
Removing *
from rsaPrivate and changing .
to ->
when calling a function to rsaPrivate.
从rsaPrivate中删除*并进行更改。 to - >调用rsaPrivate函数时。
#1
0
By the comments of this question, here is the solution.
通过这个问题的评论,这是解决方案。
Removing *
from rsaPrivate and changing .
to ->
when calling a function to rsaPrivate.
从rsaPrivate中删除*并进行更改。 to - >调用rsaPrivate函数时。