RSA BSAFE Micro Edition Suite

Streamlined security for mobile and embedded devices

Search  Print

Private Key Functions

This section describes the functions which manage private keys.

Functions

int R_CDECL SSL_CTX_use_PrivateKey (SSL_CTX *ctx, EVP_PKEY *pkey)
 Duplicates and loads the private key pkey for the SSL_CTX ctx. More...

int R_CDECL SSL_CTX_use_PrivateKey_ASN1 (SSL_CTX *ctx, unsigned char *key, long len, int type)
 Loads a private key pkey (in ASN.1 format) for the SSL_CTX structure ctx. More...

int R_CDECL SSL_CTX_check_private_key (SSL_CTX *ctx)
 Checks that the default certificate and private key of the SSL_CTX structure ctx match. More...

int R_CDECL SSL_use_PrivateKey (SSL *ssl, EVP_PKEY *pkey)
 Sets the private key pkey to be used for the SSL connection ssl. More...

int R_CDECL SSL_use_PrivateKey_ASN1 (SSL *ssl, unsigned char *data, long len, int type)
 Sets the private key data to use for the SSL connection ssl. More...

int R_CDECL SSL_check_private_key (SSL *ctx)
 Ensures the identifying certificate and the private key of an SSL structure match. More...


Function Documentation

int R_CDECL SSL_check_private_key SSL   ssl ;
 

Ensures the identifying certificate and the private key of an SSL structure match. The SSL_CTX structure is checked if the SSL structure does not hold authentication details.

Parameters:
ssl [In] The SSL structure that holds the certificate and private key.
Returns:
1 indicates there is a matching private key and certificate stored against the SSL structure.
If the SSL structure has neither, 1 indicates that the SSL_CTX structure has a match for its default certificate and private key.
0 indicates otherwise.

int R_CDECL SSL_CTX_check_private_key SSL_CTX   ctx ;
 

Checks that the default certificate and private key of the SSL_CTX structure ctx match.

Parameters:
ctx [In] The SSL_CTX structure against which to check the key.
Returns:
1 indicates the certificate matches the private key.
0 indicates otherwise.
Samples:
bio_server.c, cache_server.c, nbio_server.c, p7ssl_server.c, sock_server.c, and ssl_server.c.

int R_CDECL SSL_CTX_use_PrivateKey SSL_CTX   ctx,
EVP_PKEY   pkey
;
 

Duplicates and loads the private key pkey for the SSL_CTX ctx.

Parameters:
ctx [In] The SSL_CTX reference against which to set the default private key.
pkey [In] The private key to which the default is set.
Returns:
1 indicates success.
0 indicates error.
See also:
SSL_CTX_use_PrivateKey_file() and SSL_CTX_use_PrivateKey_ASN1().
Samples:
bio_server.c, cache_server.c, nbio_server.c, p7ssl_server.c, sock_server.c, and ssl_server.c.

int R_CDECL SSL_CTX_use_PrivateKey_ASN1 SSL_CTX   ctx,
unsigned char *    key,
long    len,
int    type
;
 

Loads a private key pkey (in ASN.1 format) for the SSL_CTX structure ctx.

Parameters:
ctx [In] The SSL_CTX structure reference against which to set the default private key.
key [In] The private key.
len [In] The private key length.
type [In] The private key type. This will be one of:
  • EVP_PKEY_RSA. /ifnot MES
  • EVP_PKEY_DSA/endif
Returns:
1 indicates success.
0 indicates error.
See also:
SSL_CTX_use_PrivateKey().

int R_CDECL SSL_use_PrivateKey SSL   ssl,
EVP_PKEY   pkey
;
 

Sets the private key pkey to be used for the SSL connection ssl.

Parameters:
ssl [In] The SSL connection reference against which to set the private key.
pkey [In] The private key reference.
Returns:
1 indicates success.
0 indicates error.

int R_CDECL SSL_use_PrivateKey_ASN1 SSL   ssl,
unsigned char *    data,
long    len,
int    type
;
 

Sets the private key data to use for the SSL connection ssl. The private key is provided in ASN.1 format.

Parameters:
ssl [In] The SSL connection reference against which to set the private key against.
data [In] The key.
len [In] The key length.
type [In] The private key type. This will be one of:
  • EVP_PKEY_RSA. /ifnot MES
  • EVP_PKEY_DSA/endif
Returns:
1 indicates success.
<= 0 indicates error.


Copyright (c) 1999-2005 RSA Security Inc. All rights reserved. 072-001001-2100-001-000 - 2.1