I don't have a solution for you, but --
> static gpgme_error_t passphrase_cb(void *hook, const char *uid_hint, const
> char *passphrase_info,
> int prev_was_bad, int fd){
>
> std::string passphraseString;
> std::cout<< "Enter your password:";
> std::cin >> passphraseString;
Use std::getline(), not >>. >> terminates at the first whitespace
character; you want to read in a full line.
> char* passphrase = new char[passphraseLength + 1];
Don't do this. C-style memory allocation is technically legal in C++,
but *strongly* advised against. For that matter, you don't need to do
it at all: you can rely on the fact the string address-of-element
operator returns a char*.
Consider the following trivial C++14 program:
#include <string>
#include <iostream>
int main()
{
std::string foo { "Zaphod Beeblebrox for President\n" };
char* bar { &foo[0] };
for (size_t index = 0 ; index < foo.size() ; index += 1)
{
std::cout << *(bar + index);
}
return 0;
}
_______________________________________________
Gnupg-users mailing list
[email protected]
http://lists.gnupg.org/mailman/listinfo/gnupg-users