1.\" $OpenBSD: OCSP_cert_to_id.3,v 1.1 2016/11/27 20:40:07 schwarze Exp $ 2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 3.\" 4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 5.\" Copyright (c) 2014, 2016 The OpenSSL Project. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in 16.\" the documentation and/or other materials provided with the 17.\" distribution. 18.\" 19.\" 3. All advertising materials mentioning features or use of this 20.\" software must display the following acknowledgment: 21.\" "This product includes software developed by the OpenSSL Project 22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 23.\" 24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 25.\" endorse or promote products derived from this software without 26.\" prior written permission. For written permission, please contact 27.\" openssl-core@openssl.org. 28.\" 29.\" 5. Products derived from this software may not be called "OpenSSL" 30.\" nor may "OpenSSL" appear in their names without prior written 31.\" permission of the OpenSSL Project. 32.\" 33.\" 6. Redistributions of any form whatsoever must retain the following 34.\" acknowledgment: 35.\" "This product includes software developed by the OpenSSL Project 36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" 37.\" 38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" 51.Dd $Mdocdate: November 27 2016 $ 52.Dt OCSP_CERT_TO_ID 3 53.Os 54.Sh NAME 55.Nm OCSP_cert_to_id , 56.Nm OCSP_cert_id_new , 57.Nm OCSP_CERTID_free , 58.Nm OCSP_id_issuer_cmp , 59.Nm OCSP_id_cmp , 60.Nm OCSP_id_get0_info 61.Nd OCSP certificate ID utility functions 62.Sh SYNOPSIS 63.In openssl/ocsp.h 64.Ft OCSP_CERTID * 65.Fo OCSP_cert_to_id 66.Fa "const EVP_MD *dgst" 67.Fa "X509 *subject" 68.Fa "X509 *issuer" 69.Fc 70.Ft OCSP_CERTID * 71.Fo OCSP_cert_id_new 72.Fa "const EVP_MD *dgst" 73.Fa "X509_NAME *issuerName" 74.Fa "ASN1_BIT_STRING *issuerKey" 75.Fa "ASN1_INTEGER *serialNumber" 76.Fc 77.Ft void 78.Fo OCSP_CERTID_free 79.Fa "OCSP_CERTID *id" 80.Fc 81.Ft int 82.Fo OCSP_id_issuer_cmp 83.Fa "OCSP_CERTID *a" 84.Fa "OCSP_CERTID *b" 85.Fc 86.Ft int 87.Fo OCSP_id_cmp 88.Fa "OCSP_CERTID *a" 89.Fa "OCSP_CERTID *b" 90.Fc 91.Ft int 92.Fo OCSP_id_get0_info 93.Fa "ASN1_OCTET_STRING **piNameHash" 94.Fa "ASN1_OBJECT **pmd" 95.Fa "ASN1_OCTET_STRING **pikeyHash" 96.Fa "ASN1_INTEGER **pserial" 97.Fa "OCSP_CERTID *cid" 98.Fc 99.Sh DESCRIPTION 100.Fn OCSP_cert_to_id 101creates and returns a new 102.Vt OCSP_CERTID 103structure using message digest 104.Fa dgst 105for certificate 106.Fa subject 107with issuer 108.Fa issuer . 109If 110.Fa dgst 111is 112.Dv NULL 113then SHA1 is used. 114.Pp 115.Fn OCSP_cert_id_new 116creates and returns a new 117.Vt OCSP_CERTID 118using 119.Fa dgst 120and issuer name 121.Fa issuerName , 122issuer key hash 123.Fa issuerKey 124and serial number 125.Fa serialNumber . 126.Pp 127.Fn OCSP_CERTID_free 128frees up 129.Fa id . 130.Pp 131.Fn OCSP_id_cmp 132compares 133.Vt OCSP_CERTID 134.Fa a 135and 136.Fa b . 137.Pp 138.Fn OCSP_id_issuer_cmp 139compares only the issuer name of 140.Vt OCSP_CERTID 141.Fa a 142and 143.Fa b . 144.Pp 145.Fn OCSP_id_get0_info 146returns the issuer name hash, hash OID, issuer key hash and serial 147number contained in 148.Fa cid . 149If any of the values are not required the corresponding parameter can be 150set to 151.Dv NULL . 152The values returned by 153.Fn OCSP_id_get0_info 154are internal pointers and must not be freed up by an application: 155they will be freed when the corresponding 156.Vt OCSP_CERTID 157structure is freed. 158.Pp 159OCSP clients will typically only use 160.Fn OCSP_cert_to_id 161or 162.Fn OCSP_cert_id_new : 163the other functions are used by responder applications. 164.Sh RETURN VALUES 165.Fn OCSP_cert_to_id 166and 167.Fn OCSP_cert_id_new 168return either a pointer to a valid 169.Vt OCSP_CERTID 170structure or 171.Dv NULL 172if an error occurred. 173.Pp 174.Fn OCSP_id_cmp 175and 176.Fn OCSP_id_issuer_cmp 177returns 0 for a match or non-zero otherwise. 178.Pp 179.Fn OCSP_id_get0_info 180returns 1 for success or 0 for failure. 181.Sh SEE ALSO 182.Xr crypto 3 , 183.Xr OCSP_request_add1_nonce 3 , 184.Xr OCSP_REQUEST_new 3 , 185.Xr OCSP_resp_find_status 3 , 186.Xr OCSP_response_status 3 , 187.Xr OCSP_sendreq_new 3 188