Re: Using libcrypto's RSA code

2013-04-18 Thread Ben Laurie
On 18 April 2013 00:17, Jakob Bohm jb-open...@wisemo.com wrote: This sounds like a gross violation of the Postel principle. A principle that should be pretty much universally violated. __ OpenSSL Project

Re: Using libcrypto's RSA code

2013-04-17 Thread Jakob Bohm
On 4/16/2013 10:28 PM, Dave Thompson wrote: From: owner-openssl-us...@openssl.org On Behalf Of Zach Sent: Tuesday, 16 April, 2013 15:55 I'm still getting an error when trying to read this key using the BIO interface: Error: error:0906D064:PEM routines:PEM_read_bio:bad base64 decode ...

RE: Using libcrypto's RSA code

2013-04-17 Thread Salz, Rich
No sane Base64 decoder should care. But the code in crypto/evp/bio_b64.c seems to be stupidly line oriented with small line buffers in an overcomplicated state, when a streaming Base64 encoder/decoder should be able to get away with a few unsigned ints and a state machine. The current behavior

Re: Using libcrypto's RSA code

2013-04-16 Thread Zach
I'm sorry it took me so long to test this...but here's the result: I'm still getting an error when trying to read this key using the BIO interface: Error: error:0906D064:PEM routines:PEM_read_bio:bad base64 decode More info below: My pubkey looks like this (this is just a test key):

RE: Using libcrypto's RSA code

2013-04-16 Thread Dave Thompson
From: owner-openssl-us...@openssl.org On Behalf Of Zach Sent: Tuesday, 16 April, 2013 15:55 I'm still getting an error when trying to read this key using the BIO interface: Error: error:0906D064:PEM routines:PEM_read_bio:bad base64 decode More info below: My pubkey looks like this

Re: Using libcrypto's RSA code

2013-04-16 Thread Zach
Dave, Thank you very much for your help! This seemed to fix my issues. -Zach On 04/16/2013 04:28 PM, Dave Thompson wrote: From: owner-openssl-us...@openssl.org On Behalf Of Zach Sent: Tuesday, 16 April, 2013 15:55 I'm still getting an error when trying to read this key using the BIO

Re: Using libcrypto's RSA code

2013-04-02 Thread Jakob Bohm
On 02-04-2013 00:30, Zach wrote: I've been reading through the OpenSSL documentation, but I must be missing something... I have a public key (base64 encoded) which looks something like this: MIICIjANBgkqhkiG9w0BAQEFA..U8CAwEAAQ== This is in a char buffer. I've tried this with/without the

Re: Using libcrypto's RSA code

2013-04-02 Thread Matt Caswell
On 1 April 2013 23:30, Zach lace...@roboticresearch.com wrote: RSA* x = PEM_read_bio_RSA_PUBKEY(bio, NULL, NULL, NULL); Try using this instead: PEM_read_bio_PUBKEY Matt

Re: Using libcrypto's RSA code

2013-04-01 Thread Zach
I've been reading through the OpenSSL documentation, but I must be missing something... I have a public key (base64 encoded) which looks something like this: MIICIjANBgkqhkiG9w0BAQEFA..U8CAwEAAQ== This is in a char buffer. I've tried this with/without the wrapping text of -BEGIN PUBLIC

RE: Using libcrypto's RSA code

2013-03-31 Thread Dave Thompson
From: owner-openssl-us...@openssl.org On Behalf Of Salz, Rich Sent: Friday, 29 March, 2013 11:47 1) Put a base64-encoded key (the normal one generated by openssl command line tools) into a header file Avoid a step. Base64 decode and using something like od put a binary bytestream into

RE: Using libcrypto's RSA code

2013-03-31 Thread Dave Thompson
From: owner-openssl-us...@openssl.org On Behalf Of Felipe Blauth Sent: Friday, 29 March, 2013 16:36 To read the key from your header file you might want to use a memory BIO in conjunction with the PEM_read_bio_PUBKEY function or PEM_read_bio_RSAPublicKey ( I don't remember which one you should

Using libcrypto's RSA code

2013-03-29 Thread Zach
I'm trying to do the following: 1) Put a base64-encoded key (the normal one generated by openssl command line tools) into a header file 2) Compile code with this key which will public-key encrypt a message. My problem: I'm not sure what interface to use to 1) read in the char array in my header

Re: Using libcrypto's RSA code

2013-03-29 Thread Matt Caswell
On 29 March 2013 15:09, Zach lace...@roboticresearch.com wrote: I'm trying to do the following: 1) Put a base64-encoded key (the normal one generated by openssl command line tools) into a header file Do you mean to put the actual key itself hardcoded into the header file?? This seems like a

RE: Using libcrypto's RSA code

2013-03-29 Thread Salz, Rich
1) Put a base64-encoded key (the normal one generated by openssl command line tools) into a header file Avoid a step. Base64 decode and using something like od put a binary bytestream into your source. Like unsigned char der_key[] = { 3, 12, 253, } 2) Compile code with this

Re: Using libcrypto's RSA code

2013-03-29 Thread Zach
The reason I want to put the public key into the header file is to simply make it easier to use the software (you can do the public key encryption of some data with only the binary file, not the binary and another file). Thus, I don't want to read a PEM file from the disk, but rather from memory.

Re: Using libcrypto's RSA code

2013-03-29 Thread Felipe Blauth
To read the key from your header file you might want to use a memory BIO in conjunction with the PEM_read_bio_PUBKEY function or PEM_read_bio_RSAPublicKey ( I don't remember which one you should use, but this was answered in this list before). I don't have a test enviroment right now, but you