xref: /openssl/doc/man3/OCSP_cert_to_id.pod (revision 7ed6de99)
1=pod
2
3=head1 NAME
4
5OCSP_cert_to_id, OCSP_cert_id_new, OCSP_CERTID_free, OCSP_id_issuer_cmp,
6OCSP_id_cmp, OCSP_id_get0_info - OCSP certificate ID utility functions
7
8=head1 SYNOPSIS
9
10 #include <openssl/ocsp.h>
11
12 OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst,
13                              X509 *subject, X509 *issuer);
14
15 OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst,
16                               X509_NAME *issuerName,
17                               ASN1_BIT_STRING *issuerKey,
18                               ASN1_INTEGER *serialNumber);
19
20 void OCSP_CERTID_free(OCSP_CERTID *id);
21
22 int OCSP_id_issuer_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b);
23 int OCSP_id_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b);
24
25 int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd,
26                       ASN1_OCTET_STRING **pikeyHash,
27                       ASN1_INTEGER **pserial, OCSP_CERTID *cid);
28
29
30=head1 DESCRIPTION
31
32OCSP_cert_to_id() creates and returns a new B<OCSP_CERTID> structure using
33message digest B<dgst> for certificate B<subject> with issuer B<issuer>. If
34B<dgst> is B<NULL> then SHA1 is used.
35
36OCSP_cert_id_new() creates and returns a new B<OCSP_CERTID> using B<dgst> and
37issuer name B<issuerName>, issuer key hash B<issuerKey> and serial number
38B<serialNumber>.
39
40OCSP_CERTID_free() frees up B<id>.
41If the argument is NULL, nothing is done.
42
43OCSP_id_cmp() compares B<OCSP_CERTID> B<a> and B<b>.
44
45OCSP_id_issuer_cmp() compares only the issuer name of B<OCSP_CERTID> B<a> and B<b>.
46
47OCSP_id_get0_info() returns the issuer name hash, hash OID, issuer key hash and
48serial number contained in B<cid>. If any of the values are not required the
49corresponding parameter can be set to B<NULL>.
50
51=head1 RETURN VALUES
52
53OCSP_cert_to_id() and OCSP_cert_id_new() return either a pointer to a valid
54B<OCSP_CERTID> structure or B<NULL> if an error occurred.
55
56OCSP_id_cmp() and OCSP_id_issuer_cmp() returns zero for a match and nonzero
57otherwise.
58
59OCSP_CERTID_free() does not return a value.
60
61OCSP_id_get0_info() returns 1 for success and 0 for failure.
62
63=head1 NOTES
64
65OCSP clients will typically only use OCSP_cert_to_id() or OCSP_cert_id_new():
66the other functions are used by responder applications.
67
68The values returned by OCSP_id_get0_info() are internal pointers and B<MUST
69NOT> be freed up by an application: they will be freed when the corresponding
70B<OCSP_CERTID> structure is freed.
71
72=head1 SEE ALSO
73
74L<crypto(7)>,
75L<OCSP_request_add1_nonce(3)>,
76L<OCSP_REQUEST_new(3)>,
77L<OCSP_resp_find_status(3)>,
78L<OCSP_response_status(3)>,
79L<OCSP_sendreq_new(3)>
80
81=head1 COPYRIGHT
82
83Copyright 2015-2024 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