In message <[EMAIL PROTECTED]> on Tue, 24 Sep 2002 14:55:53 +0200, 
Michiels Olivier <[EMAIL PROTECTED]> said:

olivier.michiels> Hi,
olivier.michiels> Currently I've an application that creates keys, certificate 
requests 
olivier.michiels> and certificates using NFast and openssl-0.9.5.
olivier.michiels> I've updated my code to use the openssl-engine.
olivier.michiels> Everything works perferctly with some modifications.
olivier.michiels> Now, I would like to use the ENGINE concept with my NFast.
olivier.michiels> I've already understood that the identifier of my ENGINE is chil and 
olivier.michiels> I've wrote some code to test if I can have a new pointer to a ENGINE 
olivier.michiels> structure.
olivier.michiels> What I would like to know is how to use this ENGINE pointer with my 
olivier.michiels> existing code, for example, what are the commands available for the 
olivier.michiels> NFAST. I've tried this little code but it doesn't work.
olivier.michiels> 
olivier.michiels> #include <openssl/engine.h>
olivier.michiels> #include <openssl/bio.h>
olivier.michiels> 
olivier.michiels> int main(int argc,char* argv[])
olivier.michiels> {
olivier.michiels>     ENGINE *e;
olivier.michiels>     BIO *err;
olivier.michiels>    

It would be a good thing to insert a call to ERR_load_crypto_strings()
here, so the errors get displayed with humanly readable reasons
instead of all those numbers.

olivier.michiels>     ENGINE_load_builtin_engines();
olivier.michiels>     if ((e = ENGINE_by_id(argv[1])) == NULL)
olivier.michiels>     {
olivier.michiels>         fprintf(stderr,"Error for: %s\n",argv[1]);
olivier.michiels>         return -1;
olivier.michiels>     }
olivier.michiels>    
olivier.michiels>     err = BIO_new_fp(stderr,BIO_NOCLOSE);
olivier.michiels>     if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
olivier.michiels>             {
olivier.michiels>             BIO_printf(err,"can't use that engine\n");
olivier.michiels>             ERR_print_errors(err);
olivier.michiels>             ENGINE_free(e);
olivier.michiels>             return -1;
olivier.michiels>             }
olivier.michiels>     BIO_printf(err,"engine \"%s\" set.\n", ENGINE_get_id(e));
olivier.michiels> 
olivier.michiels> 
olivier.michiels>     if (ENGINE_ctrl_cmd_string(e,"get_passphrase","Password:",0) == 
0)
olivier.michiels>             {
olivier.michiels>             ERR_print_errors(err);
olivier.michiels>             ENGINE_free(e);
olivier.michiels>             return -1;
olivier.michiels>             }

And exactly what was that supposed to accomplish?

olivier.michiels> 
olivier.michiels>         /* Free our "structural" reference. */
olivier.michiels>     ENGINE_free(e);
olivier.michiels>    
olivier.michiels>     return 0;
olivier.michiels> }
olivier.michiels> 
olivier.michiels> The output is has follows:
olivier.michiels> engine "chil" set.
olivier.michiels> 25983:error:260AC089:engine 
routines:func(172):reason(137):eng_ctrl.c:136:
olivier.michiels> 25983:error:260AB089:engine 
routines:func(171):reason(137):eng_ctrl.c:314:
olivier.michiels> 
olivier.michiels> I need to ask passwords in order to have my NFast working.
olivier.michiels> How can I do that ?

No, you don't need to ask for passwords at the OpenSSL level.  They
will be prompted for automatically when needed.

-- 
Richard Levitte   \ Spannvägen 38, II \ [EMAIL PROTECTED]
Redakteur@Stacken  \ S-168 35  BROMMA  \ T: +46-8-26 52 47
                    \      SWEDEN       \ or +46-708-26 53 44
Procurator Odiosus Ex Infernis                -- [EMAIL PROTECTED]
Member of the OpenSSL development team: http://www.openssl.org/

Unsolicited commercial email is subject to an archival fee of $400.
See <http://www.stacken.kth.se/~levitte/mail/> for more info.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to