[Botan-devel] Creating a class for signing data
Z. S. O.
tiredashell at gmail.com
Sat Mar 7 20:16:16 EST 2009
Sorry once again for all my questions; I only resort to this list when I've
tried everything else.
I'm trying to make classes that encapsulate various things in Botan. The one
below is meant to create digital signatures. You'll notice that I try my
best to optimize performance by making rng a global variable and signer a
class data member, so I don't have to keep recreating them locally. The
problem is that when I try to perform this->signer->sign_message(), it
creates a segmentation fault.
I admit I'm still an amateur at C++, so if I could get an explanation about
what I'm doing wrong I would really appreciate it.
MySigner (string privateKey)
auto_ptr<PKCS8_PrivateKey> loadedPrivateKey(PKCS8::load_key(key_src, rng));
RSA_PrivateKey* rsaPrivateKey =
PK_Signing_Key* key = dynamic_cast<PK_Signing_Key*>(rsaPrivateKey);
this->signer = get_pk_signer(*key, "EMSA4(SHA-1)");
string Sign (string message)
byte *msg = (unsigned char*) message.c_str();
return b64_encode(this->signer->sign_message(msg, sizeof(msg), rng));
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the botan-devel