My question is about a crypto++ constructor and why it is in the state of being "implicitly deleted" even though it follows the examples provided in the documentation. I am trying to go off of the code provided by the example on Crypto++'s documentation to create a digital signature key pair, but I am having trouble calling the constructor for AutoSeededRandomPool objects. Here is the command I am calling to the terminal:
g++ -I /usr/local/include/ -l cryptopp -std=c++11 -c -o build/account.o src/account.cpp
I am getting the following error:
error: call to implicitly-deleted copy constructor of 'CryptoPP::AutoSeededRandomPool', note: copy constructor of 'AutoSeededRandomPool' is implicitly deleted because base class 'CryptoPP::RandomPool' has a deleted copy constructor
Additionally, I get this unusual message:
clang: warning: -lcryptopp: 'linker' input unused [-Wunused-command-line-argument]
Here is are the files I use to generate the public/private key pair. They pretty much follow the example:
DSA::PrivateKey create_private_key(AutoSeededRandomPool rng) {
DSA::PrivateKey private_Key;
private_Key.GenerateRandomWithKeySize(rng, 1024);
return private_Key;
}
DSA::PublicKey create_public_key(DSA::PrivateKey private_key, AutoSeededRandomPool rng) {
DSA::PublicKey public_Key;
public_Key.AssignFrom(private_key);
if (!private_key.Validate(rng, 3) || !public_Key.Validate(rng, 3))
{
throw std::runtime_error("DSA key generation failed");
}
return public_Key;
}
I declare and initialize the AutoSeededRandomPool object in a constructor as follows:
account::account() {
balance = 0;
AutoSeededRandomPool rng;
private_key = utils::create_private_key(rng);
public_key = utils::create_public_key(private_key, rng);
}
I have linked in the libraries necessary for this, and I am linking them in when I call g++. Additionally, if anyone knows if there are any more detailed examples of Crypto++ code, those resources would be greatly appreciated.
Aucun commentaire:
Enregistrer un commentaire