summaryrefslogtreecommitdiffstats
path: root/apps/s_cb.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2004-11-16 17:30:59 +0000
committerDr. Stephen Henson <steve@openssl.org>2004-11-16 17:30:59 +0000
commit826a42a0888624780f6758df1282288cb34a570f (patch)
tree59d793bfdf70dd28de767eb0cf8c73d907940017 /apps/s_cb.c
parent19f39703f7b71e421f5de3e22e3567d03934d6a7 (diff)
PR: 910
Add command line options -certform, -keyform and -pass to s_client and s_server. This supports the use of alternative passphrase sources, key formats and keys handled by an ENGINE. Update docs.
Diffstat (limited to 'apps/s_cb.c')
-rw-r--r--apps/s_cb.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/apps/s_cb.c b/apps/s_cb.c
index 65cd0ff76b..21aab25d7e 100644
--- a/apps/s_cb.c
+++ b/apps/s_cb.c
@@ -229,6 +229,32 @@ int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file)
return(1);
}
+int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key)
+ {
+ if (SSL_CTX_use_certificate(ctx,cert) <= 0)
+ {
+ BIO_printf(bio_err,"error setting certificate\n");
+ ERR_print_errors(bio_err);
+ return 0;
+ }
+ if (SSL_CTX_use_PrivateKey(ctx,key) <= 0)
+ {
+ BIO_printf(bio_err,"error setting private key\n");
+ ERR_print_errors(bio_err);
+ return 0;
+ }
+
+
+ /* Now we know that a key and cert have been set against
+ * the SSL context */
+ if (!SSL_CTX_check_private_key(ctx))
+ {
+ BIO_printf(bio_err,"Private key does not match the certificate public key\n");
+ return 0;
+ }
+ return 1;
+ }
+
long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
int argi, long argl, long ret)
{