Replace the line "CryptoPP::StringSource( message, true, verifierFilter );" 
with:

verifierFilter->Put(part1, length1);
verifierFilter->Put(part2, length2);
// ...
verifierFilter->MessageEnd();

--------------------------------------------------
From: "Cyptmon" <[EMAIL PROTECTED]>
Sent: Sunday, October 21, 2007 3:09 PM
To: "Crypto++ Users" <[EMAIL PROTECTED]>
Subject: Re: RSA and SHA-1 speeds

>
> Thanks Wei Dai for that message. This will ensure that I compute the
> signature on 512 bit blocks, however, the code using VerifierFilter is
> something like this
>
> CryptoPP::VerifierFilter *verifierFilter = new
> CryptoPP::VerifierFilter(pub);
> verifierFilter->Put(signature, pub.SignatureLength());
> CryptoPP::StringSource( message, true, verifierFilter );
> if( false == verifierFilter->GetLastResult() )
> {
>  return false;
> }
> else
> {
>  return true;
> }
> (Taken from examples on Wiki)
>
> Now this again takes the entire message as one of the parameters
> right, is there a piecemeal way of doing this the way we generated the
> signature, say something which generates the hash using update and
> final methods and finally use RSA decryption using the public key that
> we have?
>
> Thanks again
> On Oct 21, 5:08 pm, "Wei Dai" <[EMAIL PROTECTED]> wrote:
>> You can do this using a SignerFilter object, or using the
>> NewSignatureAccumulator() and Sign() functions of the Signer class 
>> instead
>> of the SignMessage() function. (SignerFilter basically does the latter 
>> for
>> you.) For verification, use VerifierFilter.
>>
>> // untested sample code
>> RSASS<PKCS1v15, SHA>::Signer priv;
>> // initialize priv with key here
>> std::string sig;
>> SignerFilter f(rng, priv, new StringSink(sig));
>> f.Put(part1, length1);
>> f.Put(part2, length2);
>> // ...
>> f.MessageEnd();
>> // sig now contains the signature
>>
>> --------------------------------------------------
>> From: "Cyptmon" <[EMAIL PROTECTED]>
>> Sent: Sunday, October 21, 2007 12:32 PM
>> To: "Crypto++ Users" <[EMAIL PROTECTED]>
>> Subject: Re: RSA and SHA-1 speeds
>>
>>
>>
>> > Is there a way to calculate the message digest using a chained
>> > approach, wherein, I calculate the hash of data 512 bits at a time,
>> > use this hash as an IV for the next round and finally get the hash of
>> > the large chunk of data. At any time I do not want to be working on
>> > more than 512 bits of data. Can I get this digest and then sign it
>> > and subsequently verify it ? Or do we always have to pass the entire
>> > data to the Signer class?
>>
>> > On Oct 17, 5:43 pm, Cyptmon <[EMAIL PROTECTED]> wrote:
>> >> Thanks everyone
>>
>> >> I had yet another question
>>
>> >> Say I use SHA-256 for computing the hash for verifying the signature.
>> >> The data I need to sign is nearly 30MB, I just want to be sure that
>> >> the implementation follows an incremental hash sort of a thing,
>> >> wherein, the hash of one 512 bit block feeds to the next computation
>> >> as the IV. Am I right on this?
>>
>> >> Thanks
>>
>> >> On Oct 11, 3:44 pm, "Jeffrey Walton" <[EMAIL PROTECTED]> wrote:
>>
>> >> > Hi Cyptmon,
>>
>> >> > > I get the private exponent as 1024 bits, the public
>> >> > > exponent is the smaller one and it is 17 always.
>>
>> >> > You are interpreting incorrectly: 1024 is the size of the modulous. 
>> >> > 17
>> >> > is the Public Exponent.
>>
>> >> > See the dump keys example athttp://www.cryptopp.com/wiki/RSA
>>
>> >> > > PS: I hope GenerateRandomWithKeySize
>>
>> >> > One possible way to generate keys...
>>
>> >> > Jeff
>>
>> >> > On 10/11/07, Cyptmon <[EMAIL PROTECTED]> wrote:
>>
>> >> > > Thanks for the replies, I am sorry I made a mistake, I get the
>> >> > > private
>> >> > > exponent as 1024 bits, the public exponent is the smaller one and 
>> >> > > it
>> >> > > is 17 always. Why is it always 17 irrespective of the key size 
>> >> > > that I
>> >> > > specify?
>>
>> >> > > Isnt the public key chosen as something that is relatively prime 
>> >> > > to
>> >> > > Totient function of n (Phi (n )  where n is p * q)
>>
>> >> > > Thanks
>>
>> >> > > PS: I hope GenerateRandomWithKeySize is the right function to use 
>> >> > > to
>> >> > > generate different sized keys for RSA as directed by the second
>> >> > > argument passed to it
>>
>> >> > > [ SNIP ]
>
>
> > 


--~--~---------~--~----~------------~-------~--~----~
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