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