> From: owner-openssl-us...@openssl.org On Behalf Of Rafel Coyle
> Sent: Tuesday, 17 February, 2009 21:54
> To: openssl-users@openssl.org
> Subject: Re: Decryption does not yield the same as Encryption
>
>
> I sent this snippet out a few days ago, but I haven't recei
I sent this snippet out a few days ago, but I haven't received an
adequate response. I am encrypting and base 64 encoding per the code
below. I am using 15 digit Amex numbers. On some numbers I get a valid
encryption and decryption and on others my decryption ends up losing the
last character.
On Fri, Feb 13, 2009 at 4:42 PM, Rafel Coyle wrote:
> I am encrypting prior to encoding. The encryption coding is below.
>
> Also, I tried the coding changes below that were recommended and got the
> same results. Any other ideas?
Not at the moment. Given that your error is at position 15 of t
I am encrypting prior to encoding. The encryption coding is below.
Also, I tried the coding changes below that were recommended and got the
same results. Any other ideas?
buff = malloc(bptr->length + 1);
buff[bptr->length]=0;
void encrypt(char *inbuf, char *outbuf, int blklen, char *ke
At first glance, there's a thing:
1) your code shows a classic mistake in a wicked way: that is OpenSSL
works on *data*, not on *C strings*. (C strings are NUL-sentinel
terminated, data is just data, no terminator.
Since you extract the amount of *data* written to the BIO mem sink
(bptr->length),
Below is my base64 encoding code. Any ideas?
char *base64(const unsigned char *input, int length)
{
BIO *bmem, *b64;
BUF_MEM *bptr;
char *buff ;
b64 = BIO_new(BIO_f_base64());
bmem = BIO_new(BIO_s_mem());
b64 = BIO_push(b64, bmem);
BIO_write( b64, input, length);
BIO_flush( b64 );
BIO_ge
First thought as this is BIO stuff, is that you might lack a
BIO_flush() at the end (to ensure the last few bytes are puished out
and in case of crypto BIO filter also useful in a very important way
as it will trigger a call to EVP_EncryptFinal which will do te
mandatory 'end thing' like padding, e
Does anyone have any idea as to why an encryption would fail? I can
encrypt a dummy credit card number like 37870001010 and it yields
3787000101; however, if I encrypt 37870001012 the full number is
returned yielding 37870001012.
The problem appears to be with the encryption a