[Botan-devel] DSA signature verification always returns false

Z. S. O. tiredashell at gmail.com
Thu Apr 16 21:16:24 EDT 2009


The following code should (in theory) return true, but does not:
AutoSeeded_RNG rng;

DSA_PrivateKey dsaprivkey(rng, DL_Group("dsa/jce/1024"));
string publickey = X509::PEM_encode(dsaprivkey);
SecureVector<byte> msg(reinterpret_cast<const byte*>(message.data()),
message.length());
SecureVector<byte> sig = dsaprivkey.sign(msg, sizeof(msg), rng);
DataSource_Memory pubkeysrc(publickey);
auto_ptr<X509_PublicKey> loadedPublicKey(X509::load_key(pubkeysrc));
DSA_PublicKey* dsapubkey =
dynamic_cast<DSA_PublicKey*>(loadedPublicKey.get());
return dsapubkey->verify(msg, sizeof(msg), sig, sizeof(sig));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20090416/3f3d8596/attachment.html>


More information about the botan-devel mailing list