Im attempting to debug a license generation/verification
application, and am unable to figure out why the following
code is not verifying the license that has been generated.
It is using MSVC6.0 and CryptoPP 5.0.
Any ideas would be greatly appreciated.
Iain
//create a single null terminated byte array from the
provided parameters
createProfile(szCompanyName, szContactName,
szContactPhone, szContactEmail, uiDate, uiID, bMessage);
//sign the license details
RSASignFile("priv", bMessage, bSignature);
//Hexencode the license details
StringSource f(bMessage, PROFILE_SIZE, true,
new HexEncoder(
new ArraySink(bHexMessage, 2*PROFILE_SIZE)));
//Load the public key
FileSource pubFile("pub", true, new HexDecoder);
RSASSA_PKCS1v15_SHA_Verifier pubVerifier(pubFile);
SecByteBlock secSign(pubVerifier.SignatureLength());
//Load the signature into a secure memory block,
Signature needs to be HexDecoded to work and non-null
terminated
StringSource signatureString(bSignature, SIGN_SIZE, true,
new HexDecoder);
signatureString.Get(secSign.begin(), secSign.size());
//Load the signature into the verification filter
VerifierFilter *verifierFilter = new
VerifierFilter(pubVerifier);
verifierFilter->Put(secSign.data(), secSign.size());
//Load the message into the Verification Filter
StringSource x(bHexMessage, 2*PROFILE_SIZE, true,
new HexDecoder(verifierFilter));
byte result = 0;
x.Get(result);