000019183 - Load a BER/DER encoded X.509 certificate into SSL-C using the RSA BSAFE SSL-C APIs

Document created by RSA Customer Support Employee on Jun 16, 2016Last modified by RSA Customer Support Employee on Apr 21, 2017
Version 2Show Document
  • View in full screen mode

Article Content

Article Number000019183
Applies ToRSA BSAFE SSL-C
X.509 Certificate
IssueLoad a BER/DER encoded X.509 certificate into SSL-C using the RSA BSAFE SSL-C APIs
ResolutionSSL-C provides multiple ways to load digital certificates for use as part of the SSL protocol. In many cases, SSL-C provides easy functions for loading certificates from disk into memory. However, in some instances, it might not be convenient or possible for the certificates to exist in a file before being loaded by SSL-C. Depending upon the application, the following methods for loading a BER/DER encoded certificate from memory can be used. Note: tthe following examples exclude proper error checking. Refer to the SSL-C reference manuals for details about each of the functions' return values to properly handle error conditions. Using the SSLCERT APIs: char certificateData[] = ; int length = ; SSLCERT *certificate = NULL; char *pp = certificateData; certificate = SSLCERT_from_binary (NULL, &pp, length); Using the X509 APIs: char certificateData[] = ; int length = ; BIO *certBIO = NULL; X509 *certificate = NULL; char *pp = certificateData; certBIO = BIO_new_mem (); /* Write the certificate data to the BIO. */ BIO_write (certBIO, certificateData, length); certificate = X509_new (); d2i_X509_bio (certBIO, certificate); Once the certificate has been loaded into a SSLCERT or X509 object, it can be used with the appropriate SSL-C APIs that require certificate objects.
Legacy Article IDa6600

Attachments

    Outcomes