A collection for working with certificates. More...
Classes | |
| class | evp_pkey_handle |
| Handle class for EVP_PKEY structures. More... | |
Functions | |
| std::unique_ptr< BIO, decltype(&BIO_free_all)> | make_mem_buf_bio () |
| std::unique_ptr< BIO, decltype(&BIO_free_all)> | make_mem_buf_bio (const std::string &data) |
| std::unique_ptr< EVP_MD_CTX, void(*)(EVP_MD_CTX *)> | make_evp_md_ctx () |
| std::string | extract_pubkey_from_cert (const std::string &certstr, const std::string &pw, std::error_code &ec) |
| Extract the public key of a pem certificate. More... | |
| std::string | extract_pubkey_from_cert (const std::string &certstr, const std::string &pw="") |
| Extract the public key of a pem certificate. More... | |
| template<typename Decode > | |
| std::string | convert_base64_der_to_pem (const std::string &cert_base64_der_str, Decode decode, std::error_code &ec) |
| Convert the certificate provided as base64 DER to PEM. More... | |
| template<typename Decode > | |
| std::string | convert_base64_der_to_pem (const std::string &cert_base64_der_str, Decode decode) |
| Convert the certificate provided as base64 DER to PEM. More... | |
| std::string | convert_base64_der_to_pem (const std::string &cert_base64_der_str, std::error_code &ec) |
| Convert the certificate provided as base64 DER to PEM. More... | |
| std::string | convert_base64_der_to_pem (const std::string &cert_base64_der_str) |
| Convert the certificate provided as base64 DER to PEM. More... | |
| evp_pkey_handle | load_public_key_from_string (const std::string &key, const std::string &password, std::error_code &ec) |
| Load a public key from a string. More... | |
| evp_pkey_handle | load_public_key_from_string (const std::string &key, const std::string &password="") |
| Load a public key from a string. More... | |
| evp_pkey_handle | load_private_key_from_string (const std::string &key, const std::string &password, std::error_code &ec) |
| Load a private key from a string. More... | |
| evp_pkey_handle | load_private_key_from_string (const std::string &key, const std::string &password="") |
| Load a private key from a string. More... | |
| evp_pkey_handle | load_public_ec_key_from_string (const std::string &key, const std::string &password, std::error_code &ec) |
| Load a public key from a string. More... | |
| evp_pkey_handle | load_public_ec_key_from_string (const std::string &key, const std::string &password="") |
| Load a public key from a string. More... | |
| evp_pkey_handle | load_private_ec_key_from_string (const std::string &key, const std::string &password, std::error_code &ec) |
| Load a private key from a string. More... | |
| evp_pkey_handle | load_private_ec_key_from_string (const std::string &key, const std::string &password="") |
| Load a private key from a string. More... | |
| std::string | bn2raw (const BIGNUM *bn) |
| std::unique_ptr< BIGNUM, decltype(&BN_free)> | raw2bn (const std::string &raw) |
A collection for working with certificates.
These helpers are usefully when working with certificates OpenSSL APIs. For example, when dealing with JWKS (JSON Web Key Set)[https://tools.ietf.org/html/rfc7517] you maybe need to extract the modulus and exponent of an RSA Public Key.
|
inline |
Convert a OpenSSL BIGNUM to a std::string
| bn | BIGNUM to convert |
|
inline |
Convert the certificate provided as base64 DER to PEM.
This is useful when using with JWKs as x5c claim is encoded as base64 DER. More info (here)[https://tools.ietf.org/html/rfc7517#section-4.7]
| cert_base64_der_str | String containing the certificate encoded as base64 DER |
| rsa_exception | if an error occurred |
| std::string jwt::helper::convert_base64_der_to_pem | ( | const std::string & | cert_base64_der_str, |
| Decode | decode | ||
| ) |
Convert the certificate provided as base64 DER to PEM.
This is useful when using with JWKs as x5c claim is encoded as base64 DER. More info (here)[https://tools.ietf.org/html/rfc7517#section-4.7]
| Decode | is callabled, taking a string_type and returns a string_type. It should ensure the padding of the input and then base64 decode and return the results. |
| cert_base64_der_str | String containing the certificate encoded as base64 DER |
| decode | The function to decode the cert |
| rsa_exception | if an error occurred |
| std::string jwt::helper::convert_base64_der_to_pem | ( | const std::string & | cert_base64_der_str, |
| Decode | decode, | ||
| std::error_code & | ec | ||
| ) |
Convert the certificate provided as base64 DER to PEM.
This is useful when using with JWKs as x5c claim is encoded as base64 DER. More info (here)[https://tools.ietf.org/html/rfc7517#section-4.7]
| Decode | is callabled, taking a string_type and returns a string_type. It should ensure the padding of the input and then base64 decode and return the results. |
| cert_base64_der_str | String containing the certificate encoded as base64 DER |
| decode | The function to decode the cert |
| ec | error_code for error_detection (gets cleared if no error occures) |
|
inline |
Convert the certificate provided as base64 DER to PEM.
This is useful when using with JWKs as x5c claim is encoded as base64 DER. More info (here)[https://tools.ietf.org/html/rfc7517#section-4.7]
| cert_base64_der_str | String containing the certificate encoded as base64 DER |
| ec | error_code for error_detection (gets cleared if no error occures) |
|
inline |
Extract the public key of a pem certificate.
| certstr | String containing the certificate encoded as pem |
| pw | Password used to decrypt certificate (leave empty if not encrypted) |
| ec | error_code for error_detection (gets cleared if no error ocurred) |
|
inline |
Extract the public key of a pem certificate.
| certstr | String containing the certificate encoded as pem |
| pw | Password used to decrypt certificate (leave empty if not encrypted) |
| rsa_exception | if an error occurred |
|
inline |
Load a private key from a string.
| key | String containing a private key as pem |
| password | Password used to decrypt key (leave empty if not encrypted) |
| ec | error_code for error_detection (gets cleared if no error occures) |
|
inline |
Load a private key from a string.
| key | String containing a private key as pem |
| password | Password used to decrypt key (leave empty if not encrypted) |
| ecdsa_exception | if an error occurred |
|
inline |
Load a private key from a string.
| key | String containing a private key as pem |
| password | Password used to decrypt key (leave empty if not encrypted) |
| ec | error_code for error_detection (gets cleared if no error occures) |
|
inline |
Load a private key from a string.
| key | String containing a private key as pem |
| password | Password used to decrypt key (leave empty if not encrypted) |
| rsa_exception | if an error occurred |
|
inline |
Load a public key from a string.
The string should contain a pem encoded certificate or public key
| key | String containing the certificate encoded as pem |
| password | Password used to decrypt certificate (leave empty if not encrypted) |
| ec | error_code for error_detection (gets cleared if no error occures) |
|
inline |
Load a public key from a string.
The string should contain a pem encoded certificate or public key
| key | String containing the certificate or key encoded as pem |
| password | Password used to decrypt certificate or key (leave empty if not encrypted) |
| ecdsa_exception | if an error occurred |
|
inline |
Load a public key from a string.
The string should contain a pem encoded certificate or public key
| key | String containing the certificate encoded as pem |
| password | Password used to decrypt certificate (leave empty if not encrypted) |
| ec | error_code for error_detection (gets cleared if no error occures) |
|
inline |
Load a public key from a string.
The string should contain a pem encoded certificate or public key
| key | String containing the certificate or key encoded as pem |
| password | Password used to decrypt certificate or key (leave empty if not encrypted) |
| rsa_exception | if an error occurred |
|
inline |
|
inline |
|
inline |
|
inline |
Convert an std::string to a OpenSSL BIGNUM
| raw | String to convert |