On Mon, Nov 24, 2008 at 05:59:39PM -0800, Shaun wrote:

> I used fwrite(signature,1,strlen(signature),fp) and got the same results.

Which part of length of signature != strlen(signature) because signature
is not a NUL terminated C-string is not clear?

Which part of 'you are throwing away "slen"' is not clear?

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Victor Duchovni
> Sent: Saturday, November 22, 2008 1:25 PM
> To: openssl-users@openssl.org
> Subject: Re: sign/verify kicking my ass
> 
> On Sat, Nov 22, 2008 at 10:38:18AM -0800, Shaun R. wrote:
> 
> > Can anybody help me out, not sure whats going wrong.  My test case right 
> > now is the following
> > 
> >        signature = (unsigned char*) malloc(RSA_size(private_key));
> >        if(RSA_sign(NID_sha1, (unsigned char*) message, strlen(message), 
> > signature, &slen, private_key) != 1) {
> >                ERR_print_errors_fp(stdout);
> >        }
> > 
> >        printf("%s", signature);
> 
> The signature is not a NUL terminated C-string, so using "printf" is
> not the right way to save it to a file. You are throwing away "slen",
> don't.

-- 
        Viktor.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to