Hi there!

I have a binary file with the following content


   - length of the signature as an uint32
   - signature
   - length of the data as an uint32
   - data

and I'd like to verify the data. First I create my verifier like this:

CryptoPP::RSA::PublicKey publicKey;
CryptoPP::Integer n(PUBLIC_KEY_MODULUS, sizeof(PUBLIC_KEY_MODULUS));
CryptoPP::Integer e(PUBLIC_KEY_EXPONENT, sizeof(PUBLIC_KEY_EXPONENT));
publicKey.Initialize(n, e);
CryptoPP::RSASS<CryptoPP::PKCS1v15, CryptoPP::SHA1>::Verifier 
verifier(publicKey);

Then I tried the following for verifying the data:

CryptoPP::VerifierFilter* verifierFilter = new 
CryptoPP::VerifierFilter(verifier);
CryptoPP::FileSource fileSource(packagePath.c_str(), false, verifierFilter);
uint32_t len;
fileSource.GetWord32(len);    // get signature length
fileSource.Pump(len);        // pump signature length to verifier filter
fileSource.GetWord32(len);    // get data length
fileSource.Pump(len);        // pump data to verifier filter
bool valid = verifierFilter->GetLastResult();

But it returns false. I also tried this:

CryptoPP::FileSource fileSource(packagePath.c_str(), true);
CryptoPP::VerifierFilter verifierFilter(verifier);
uint32_t len;
fileSource.GetWord32(len);
fileSource.TransferTo(verifierFilter, len);
fileSource.GetWord32(len);
fileSource.TransferTo(verifierFilter, len);
bool valid = verifierFilter.GetLastResult();

But it doesn't work either. 

What's wrong with this code?

Cheers

Robert

-- 
-- 
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.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to