getline() reads a line. Perhaps the signature is stored in binary? It
could then contain a newline, so getline() would stop reading there.
You probably want fstream::read() instead of getline().

Chris

On Mon, 23 Jul 2012 11:15:15 -0700 (PDT)
Michele <[email protected]> wrote:

> 
> Finally I found the bug:
> The SignerFilter generate ever a signature of 192 bytes in size. 
> SignatureVerificationFilter expects a signature exactly  192 bytes in
> size, if it is more or less the verify fails beacuse "digital
> signature is not valid".
> Here is how I save the key:
> 
> cout << SIGNATURE.size() << "bytes\n";    //check that SIGNATURE
> generated is ever 192 bytes
> 
> fstream f1;
> 
> f1.open("./Signatures", fstream::out | fstream::binary);
> f1.write(SIGNATURE.c_str(),SIGNATURE.size());          //if i check
> the file created when, after the program ends running, is is EVER 192
> bytes in size
> f1.close();
> 
> fstream f2;
> 
> f1.open("./Signatures", fstream::in | fstream::binary);
> getline(f1,signature);                                                     
>      //it reads ever something
> f1.close();
> 
> cout  << signature.size() <<"bytes\n";                //sometimes
> this is not 192 bytes, then the verify fails
> 
> I need a way to understand WHY the reading of the files fails. Maybe 
> something goes wrong with the getline?
> Any ideas?
> 

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