Re: Convert symmetrically encrypted content to base64

2012-08-27 Thread Bjoern Schiessle
On Fri, 24 Aug 2012 15:54:50 -0400 Dave Thompson wrote: > Note OpenSSL's RSA privatekey *includes* publickey. > RSA publickey is n,e and naive privatekey is n,d, > but OpenSSL privatekey is CRT form with n,d,e,p,q + more. > There is no need to transmit the publickey separately, > > [..] > > >

RE: Convert symmetrically encrypted content to base64

2012-08-24 Thread Dave Thompson
> From: owner-openssl-us...@openssl.org On Behalf Of Bjoern Schiessle > Sent: Friday, 24 August, 2012 12:14 > Now I'm trying the implement the function > which does exactly the opposite: Take the public and private key in > the PEM format from the server and import it in a RSA structure: > Note

Re: Convert symmetrically encrypted content to base64

2012-08-24 Thread Bjoern Schiessle
Hi Christian, On Fri, 24 Aug 2012 08:11:25 +0200 Christian Hohnstaedt wrote: > please see my comments below: > (rather Qt and memory related) Thank you for your feedback. Now I'm trying the implement the function which does exactly the opposite: Take the public and private key in the PEM format f

Re: Convert symmetrically encrypted content to base64

2012-08-23 Thread Christian Hohnstaedt
Hi Bjoern, please see my comments below: (rather Qt and memory related) On Thu, Aug 23, 2012 at 03:12:55PM +0200, Bjoern Schiessle wrote: > > QMap Encryption::key2pem(RSA *rsa, QString password) > { > QMap keypair; > BUF_MEM *bptr; > BIO *pubBio = BIO_new(BIO_s_mem()); > BIO *pri

Re: Convert symmetrically encrypted content to base64

2012-08-23 Thread Bjoern Schiessle
Hi, I think I did it way too complicated. I think the problem was that I always tried to mimic some openssl php code I know, but I think the solution I have now is much easier and standard complained: void Encryption::generateUserKeys(QString password) { RSA *rsa; EVP_PKEY *pkey; int

Convert symmetrically encrypted content to base64

2012-08-23 Thread Bjoern Schiessle
Hi, I want to generate a RSA private and public key and than encrypt the private key symmetrically with a password to store it on a server. The data has to be stored and transferred base64 encoded. This is how I encrypt the private key: EVP_CIPHER_CTX ctx; unsigned char *key = (unsigned