3
votes

I am trying to just initialize a PK_Signer object, which seems to be giving me much more problems then Botan version 1.8.10. I am currently using Botan's latest stable release (1.10), and I am having trouble...

In Botan 1.8.10, I see examples where programmers go like this:

Botan::RSA_PrivateKey pkey(rng, p, q, 65537, 0, n);
Botan::PK_Signer signer(pkey, "EMSA3(SHA-1)");

In Botan 1.10.3, there is no contructor like that for the PK_Signer class. There are 2 constuctors:

Botan::PK_Signer(const PK_Signer &);
Botan::PK_Signer(const PK_Signing_Key &key, EMSA *emsa);

This was not a problem, until I started actually having trouble with the second constructor.

I've tried changing many things, but the way that makes the most sense is by going: Botan::AutoSeeded_RNG rng; Botan::RSA_PrivateKey pkey(rng, p, q, 0x10001, 0, n);

Botan::EMSA3 emsa(Botan::SHA_160);
Botan::PK_Signer signer(pkey, &emsa);

Doing this throws the error:

error: no matching function for call to 'Botan::PK_Signer::PK_Signer(Botan::RSA_PrivateKey&, Botan::EMSA3 (*)(Botan::SHA_160))'

I have no idea why this happens, as according to the Botan documentation EMSA3 inherits from the abstract class EMSA. Thanks for any help, Hetelek.

1

1 Answers

1
votes

Botan::SHA_160 is a class, so the emsa variable you were defining was a function not a EMSA3 instance.

According to the examples from Botan 1.8, you could use:

 #include <botan/look_pk.h>
 ...
 Botan::PK_Signer signer(pkey, get_emsa("EMSA3(SHA-1)"));

which should also work in Botan 1.10.