CTLOG_NEW(3ossl)
π CTLOG_NEW(3ossl) π
okay bestie, pull up a chair, we're talking about CTLOG_new_ex, CTLOG_new, CTLOG_new_from_base64, CTLOG_new_from_base64_ex, CTLOG_free, CTLOG_get0_name, CTLOG_get0_log_id, and CTLOG_get0_public_key β the whole little friend group that wraps up everything you need to know about a Certificate Transparency log. π¦
β¨ NAME β¨
These functions are all about encapsulating information about a Certificate Transparency log. That's the whole vibe. No cap.
πΈ SYNOPSIS πΈ
#include <openssl/ct.h>
CTLOG *CTLOG_new_ex(EVP_PKEY *public_key, const char *name,
OSSL_LIB_CTX *libctx, const char *propq);
CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name);
int CTLOG_new_from_base64_ex(CTLOG **ct_log, const char *pkey_base64,
const char *name, OSSL_LIB_CTX *libctx,
const char *propq);
int CTLOG_new_from_base64(CTLOG ** ct_log,
const char *pkey_base64, const char *name);
void CTLOG_free(CTLOG *log);
const char *CTLOG_get0_name(const CTLOG *log);
void CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id,
size_t *log_id_len);
EVP_PKEY *CTLOG_get0_public_key(const CTLOG *log);
π DESCRIPTION π
CTLOG_new_ex() returns a brand new CTLOG that represents the Certificate Transparency (CT) log with the given public key, and it associates that log with the library context libctx and the property query string propq. You also gotta provide a name, because that's what helps people actually identify which log they're looking at. Also heads up: ownership of the public key is transferred. It's yours no more, bestie, it belongs to the CTLOG now. π
CTLOG_new() does the exact same thing as CTLOG_new_ex() β literally identical energy β except it uses the default library context and the default property query string. Simple. Iconic.
CTLOG_new_from_base64_ex() also creates a new CTLOG, but it's got a little twist: it takes the public key in base64-encoded DER form, and it sets the ct_log pointer to point at the new CTLOG. The base64 gets decoded and the public key gets parsed. Then the CTLOG is associated with the given library context libctx and property query string propq. So fancy. β¨
CTLOG_new_from_base64() does the same thing as CTLOG_new_from_base64_ex(), except that the default library context and the default property query string are used. That's the whole difference, periodt.
Now here's the part where you have to be a responsible main character: regardless of whether you used CTLOG_new() or CTLOG_new_from_base64(), it is the caller's responsibility to pass the CTLOG to CTLOG_free() once it is no longer needed. That call will delete it β and if it was created by CTLOG_new(), it'll also delete the EVP_PKEY that was passed to it. And if the argument to CTLOG_free() is NULL? Nothing happens. Nothing is done. It's a no-op, bestie, we love a chill function. π
CTLOG_get0_name() returns the name of the log β the one that was provided when the CTLOG was created. Ownership of that string stays with the CTLOG, so don't go freeing it yourself, okay?
CTLOG_get0_log_id() sets *log_id to point to a string containing that log's LogID (see RFC 6962, iykyk). It also sets *log_id_len to the length of that LogID. And for a v1 CT log, the LogID will be a SHA-256 hash β so that's 32 bytes long, for the record. Ownership of the string remains with the CTLOG. Same rules as before. π
CTLOG_get0_public_key() returns the public key of the CT log. And yep, you guessed it: ownership of the EVP_PKEY remains with the CTLOG.
π RETURN VALUES π
CTLOG_new()will returnNULLif an error occurs. That's the bad timeline. πCTLOG_new_from_base64()will return1on success, and0otherwise.
π SEE ALSO π
π HISTORY π
The functions CTLOG_new_ex() and CTLOG_new_from_base64_ex() were added in OpenSSL 3.0. All the other functions were added in OpenSSL 1.1.0. So the _ex girlies are the newer additions to the squad. β
π«Ά COPYRIGHT π«Ά
Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
fr fr, read the license before you go doing anything wild with this. π
and that's the whole page, bestie!! π¦β¨ this was CTLOG_NEW(3ossl) from OpenSSL 3.5.9, dated 2026-09-29 β thank you for coming to my ted talk, go forth and encapsulate your Certificate Transparency logs responsibly ππΈπ
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms