On Mon, Feb 21, 2011 at 09:03, Magnus J <[email protected]> wrote:
> Thank you.
>
>> Then I have a factory function that takes the digest buffer and length
>> as parameters and returns a pointer to a newly allocated
>> CryptoPP::PK_MessageAccumulatorImpl<MyExternalDigestHashTransformation>.
>
> This part gets me a bit perplex though. I still don't see how you get
> the hash into the message accumulator. The PK_MessageAccumulatorImpl
> objectholder looks very protected.
>

It's kind of a dirty trick, but the only way I could find to wire this
in without subclassing for each digest I wanted. (If anyone knows a
cleaner way to accomplish this, I'd love to hear. I can confirm that
this works, though :-) )

Here's the relevant code from my factory:
http://cryptopp.pastebin.com/d0DHqaqF

Then when signing, the basic flow is
PK_Signer * signer = 0; // set up signer for the algorithm you need
PKIFCryptoPPErrorsAccumulator * ed = NewEDAccumulator(pHashData,nHashDataLen);
signer->Sign(rng, ed, pSignature);

And when verifying it's
PK_Verifier * verifier = 0; // set up verifier for the algorithm you need
PKIFCryptoPPExternalDigestAccumulator * ed =
NewEDAccumulator(pHashData,nHashDataLen);
verifier->InputSignature(*ed,pSignature,nSignatureLen);
bool verified = verifier->Verify(ed);


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