xref: /freebsd/crypto/openssl/doc/man3/CTLOG_new.pod (revision ba3c1f5972d7b90feb6e6da47905ff2757e0fe57)
1=pod
2
3=head1 NAME
4
5CTLOG_new_ex, CTLOG_new, CTLOG_new_from_base64,
6CTLOG_new_from_base64_ex, CTLOG_free,
7CTLOG_get0_name, CTLOG_get0_log_id, CTLOG_get0_public_key -
8encapsulates information about a Certificate Transparency log
9
10=head1 SYNOPSIS
11
12 #include <openssl/ct.h>
13
14 CTLOG *CTLOG_new_ex(EVP_PKEY *public_key, const char *name,
15                     OSSL_LIB_CTX *libctx, const char *propq);
16 CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name);
17
18 int CTLOG_new_from_base64_ex(CTLOG **ct_log, const char *pkey_base64,
19                              const char *name, OSSL_LIB_CTX *libctx,
20                              const char *propq);
21 int CTLOG_new_from_base64(CTLOG ** ct_log,
22                           const char *pkey_base64, const char *name);
23 void CTLOG_free(CTLOG *log);
24 const char *CTLOG_get0_name(const CTLOG *log);
25 void CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id,
26                        size_t *log_id_len);
27 EVP_PKEY *CTLOG_get0_public_key(const CTLOG *log);
28
29=head1 DESCRIPTION
30
31CTLOG_new_ex() returns a new CTLOG that represents the Certificate
32Transparency (CT) log with the given public key and associates it with the
33library context I<libctx> and property query string I<propq>. A name must also
34be provided that can be used to help users identify this log. Ownership of the
35public key is transferred.
36
37CTLOG_new() does the same thing as CTLOG_new_ex() but with the default
38library context and the default property query string.
39
40CTLOG_new_from_base64_ex() also creates a new CTLOG, but takes the
41public key in base64-encoded DER form and sets the ct_log pointer to point to
42the new CTLOG. The base64 will be decoded and the public key parsed. The CTLOG
43will be associated with the given library context I<libctx> and property query
44string I<propq>.
45
46CTLOG_new_from_base64() does the same thing as
47CTLOG_new_from_base64_ex() except that the default library context and
48property query string are used.
49
50Regardless of whether CTLOG_new() or CTLOG_new_from_base64() is used, it is the
51caller's responsibility to pass the CTLOG to CTLOG_free() once it is no longer
52needed. This will delete it and, if created by CTLOG_new(), the EVP_PKEY that
53was passed to it.
54
55CTLOG_get0_name() returns the name of the log, as provided when the CTLOG was
56created. Ownership of the string remains with the CTLOG.
57
58CTLOG_get0_log_id() sets *log_id to point to a string containing that log's
59LogID (see RFC 6962). It sets *log_id_len to the length of that LogID. For a
60v1 CT log, the LogID will be a SHA-256 hash (i.e. 32 bytes long). Ownership of
61the string remains with the CTLOG.
62
63CTLOG_get0_public_key() returns the public key of the CT log. Ownership of the
64EVP_PKEY remains with the CTLOG.
65
66=head1 RETURN VALUES
67
68CTLOG_new() will return NULL if an error occurs.
69
70CTLOG_new_from_base64() will return 1 on success, 0 otherwise.
71
72=head1 SEE ALSO
73
74L<ct(7)>
75
76=head1 HISTORY
77
78The functions CTLOG_new_ex() and CTLOG_new_from_base64_ex()
79were added in OpenSSL 3.0. All other functions were added in OpenSSL 1.1.0.
80
81=head1 COPYRIGHT
82
83Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
84
85Licensed under the Apache License 2.0 (the "License").  You may not use
86this file except in compliance with the License.  You can obtain a copy
87in the file LICENSE in the source distribution or at
88L<https://www.openssl.org/source/license.html>.
89
90=cut
91