Ahh, ok... When you first said that you where just saying printf was wrong to use because it was not a string, it makes sense that strlen wouldn't work either, i just missed that.
I know I'm throwing away slen in the example, I'm curious how I would pass it along though in my tests with two separate programs, I would have to pass the size along too somehow right? Couldn't I use RSA_size(pubkey) to set slen? -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Victor Duchovni Sent: Monday, November 24, 2008 6:41 PM To: openssl-users@openssl.org Subject: Re: sign/verify kicking my ass 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] ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]