Hi everyone,

First I will admit being new to the list.

I am trying to solve a technical problem and I believe I have one last
piece to resolve.  I know that from the command line I can duplicate
what I need to do using the commands:

openssl rsautil -encrypt -inkey pub.key etc
openssl rsautil -decrypt -inkey priv.key etc

For reasons which I cannot discuss I need to hide my private key
within my application and the decrypted data will also be used
internally and not written out to a file. My encrypted data will still
be in a file.

Using the rsautl.c source code as a model, I believe I should be able
to duplicate the command line in my source code using the functions:

RSA_private_encrypt(int flen, unsigned char *from, unsigned char *to,
RSA *rsa, int padding);
RSA_private_decrypt(int flen, unsigned char *from, unsigned char *to,
RSA *rsa, int padding);

For rsa_in, rsa_out and padding I plan to use:

unsigned char *rsa_in = OPENSSL_malloc(keysize * 2);
rsa_inlen = BIO_read(in, rsa_in, keysize * 2);
unsigned char *rsa_out = OPENSSL_malloc(keysize);
int padding = RSA_PKCS1_PADDING;

So my questions are, how do I replicate what load_key() to populate
pkey (EVP_PKEY *)? And, are they any data functions that can be used
to replace what the BIO functions do for files?

Thanks,
--
==============================================================================
                               John T. Cox
                         e-mail [EMAIL PROTECTED]
                   www http://members.iglou.com/vampire
==============================================================================
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to