Goby3
3.1.5a
2024.05.23
|
A collection for working with certificates. More...
Functions | |
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... | |
std::shared_ptr< EVP_PKEY > | 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... | |
std::shared_ptr< EVP_PKEY > | load_public_key_from_string (const std::string &key, const std::string &password="") |
Load a public key from a string. More... | |
std::shared_ptr< EVP_PKEY > | 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... | |
std::shared_ptr< EVP_PKEY > | load_private_key_from_string (const std::string &key, const std::string &password="") |
Load a private key from a string. More... | |
std::shared_ptr< EVP_PKEY > | 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... | |
std::shared_ptr< EVP_PKEY > | load_public_ec_key_from_string (const std::string &key, const std::string &password="") |
Load a public key from a string. More... | |
std::shared_ptr< EVP_PKEY > | 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... | |
std::shared_ptr< EVP_PKEY > | 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 |
|
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 |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
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 |