SSLClient  v1.1.1
Add TLS 1.2 functionality to any network library.
SSLObj Namespace Reference

This namespace works with raw DER byte arrays for use later with TLS mutual auth. More...

Functions

const std::vector< unsigned char > make_vector_pem (const char *data, const size_t len)
 Convert a PEM buffer into a vector of raw DER bytes. More...
 

Detailed Description

This namespace works with raw DER byte arrays for use later with TLS mutual auth.

SSLObj.h

This file contains a utility class to take PEM input and store it as a DER object for later use by BearSSL.This namespace was created to store some of the values stored in SSLClientParameters, which allow BearSSL use client certificates when creating a TLS connection. Since most certificates are transmitted over the internet in PEM format, a certificate can be provided in PEM or DER format, and will be converted internally to DER format for later use.

Function Documentation

◆ make_vector_pem()

const std::vector< unsigned char > SSLObj::make_vector_pem ( const char *  data,
const size_t  len 
)

Convert a PEM buffer into a vector of raw DER bytes.

This function takes a PEM buffer (e.g. ----BEGIN CERTIFICATE...) and converts it into a vector of raw bytes. The bytes given to this function must:

  • Contain both the -----BEGIN XXX----- and -----END XXX----- strings. These are removed during processing.
  • Have a base64 encoded body
  • Only contain a single object (certificate, private key, etc.).
Returns
The raw bytes decoded from the PEM file.