You need to use PKCS#8 format for the private key.

Here's the source to a simple file signing program that uses crypto++:
http://pastebin.com/ce1TRyZk

Here's the source to a simple file verification program that uses crypto++:
http://pastebin.com/hE0mEr9d

Here's a command-line transcript of how those two programs can use
keys generated by openssl:
$ openssl genrsa 2048 >privkey.pem
Generating RSA private key, 2048 bit long modulus
..............+++
....................................+++
e is 65537 (0x10001)
$ openssl pkcs8 -in privkey.pem -out privkey.p8 -topk8 -nocrypt -outform der
$ openssl rsa -in privkey.pem -pubout -out pubkey.der -outform der
writing RSA key
$ ./filesign-cryptopp -k privkey.p8 -o sig.bin Makefile
Signature over Makefile written to sig.bin.
$ ./fileverify-cryptopp -k pubkey.der -s sig.bin Makefile
Signature was successfuly verified.

Everything in that code is public domain. (Most of it probably came
from test.cpp distributed with crypto++...) I'd recommend adding quite
a bit more error checking before you use it for anything important,
though :)

HTH,

Geoff

-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.

Reply via email to