CTLOG_NEW(3SSL)
π CTLOG_NEW π β the CTLOG_NEW(3SSL) page, bestie edition
okay so. you're here for the CTLOG_NEW(3SSL) manual, and honestly? iconic choice. this whole family of functions is about wrapping up β¨information about a Certificate Transparency logβ¨ (a CT log, for the girlies in the back). come sit, we're doing this together π«Ά
πΈ NAME πΈ
CTLOG_new_ex, CTLOG_new, CTLOG_new_from_base64, CTLOG_new_from_base64_ex, CTLOG_free, CTLOG_get0_name, CTLOG_get0_log_id, CTLOG_get0_public_key β literally all of them exist to encapsulate 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 π
so CTLOG_new_ex() returns a brand new CTLOG that represents the Certificate Transparency (CT) log with the public key you hand it, and it links that baby up with the library context libctx and the property query string propq. you also have to give it a name, because that name is what helps users figure out which log they're looking at. π
and yes bestie, heads up: ownership of the public key is transferred. it's yours no more. it belongs to the CTLOG now.
CTLOG_new() is literally the same thing as CTLOG_new_ex() except it rolls with the default library context and the default property query string. same energy, less paperwork.
CTLOG_new_from_base64_ex() also makes a new CTLOG, but plot twist β it takes the public key in base64-encoded DER form and sets the ct_log pointer to point at the new CTLOG. the base64 gets decoded, the public key gets parsed. and this CTLOG gets associated with the library context libctx and property query string propq you passed in. the way it does all that in one call?? ate. π
CTLOG_new_from_base64() is the same thing as CTLOG_new_from_base64_ex() except β you guessed it β default library context and default property query string.
now listen, because this part matters and it's giving responsibility. no matter whether you used CTLOG_new() or CTLOG_new_from_base64(), it is the caller's job to pass the CTLOG to CTLOG_free() once you don't need it anymore. that deletes it β and if it was created by CTLOG_new(), it also deletes the EVP_PKEY that was passed into it. and if the argument to CTLOG_free() is NULL? nothing happens. no drama, nothing done. π
CTLOG_get0_name() returns the name of the log, exactly as provided when the CTLOG was created. ownership of that string stays with the CTLOG, so don't go freeing it yourself. π
CTLOG_get0_log_id() sets *log_id to point to a string containing that log's LogID (peep RFC 6962 for the lore). it also sets *log_id_len to the length of that LogID. for a v1 CT log, the LogID will be a SHA-256 hash β so 32 bytes long, you're welcome. and again, ownership of that string remains with the CTLOG.
CTLOG_get0_public_key() returns the public key of the CT log. and, once again because this is the theme of the whole page, ownership of the EVP_PKEY remains with the CTLOG. π
π RETURN VALUES π
CTLOG_new()will returnNULLif an error occurs.CTLOG_new_from_base64()will return1on success,0otherwise.
fr fr, write those checks. future you will be obsessed with past you for doing it. π
π¦ 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. glow-up timeline, honestly. β
π 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>.
and that's the whole page, bestie!! π this one's from OpenSSL version 4.0.3, dated 2026-09-29 β main character energy from cover to cover, periodt. πβ¨π¦
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms