1.\" $OpenBSD: X509_find_by_subject.3,v 1.1 2021/07/04 12:56:27 schwarze Exp $ 2.\" 3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: July 4 2021 $ 18.Dt X509_FIND_BY_SUBJECT 3 19.Os 20.Sh NAME 21.Nm X509_find_by_subject , 22.Nm X509_find_by_issuer_and_serial 23.Nd search an array of X.509 certificates 24.Sh SYNOPSIS 25.In openssl/x509.h 26.Ft X509 * 27.Fo X509_find_by_subject 28.Fa "STACK_OF(X509) *sk" 29.Fa "X509_NAME *subject" 30.Fc 31.Ft X509 * 32.Fo X509_find_by_issuer_and_serial 33.Fa "STACK_OF(X509) *sk" 34.Fa "X509_NAME *issuer" 35.Fa "ASN1_INTEGER *serial" 36.Fc 37.Sh DESCRIPTION 38.Fn X509_find_by_subject 39searches the variable-sized array 40.Fa sk 41for a certificate with a matching 42.Fa subject 43name. 44.Pp 45.Fn X509_find_by_issuer_and_serial 46searches the array for a certificate where both the 47.Fa issuer 48name and the 49.Fa serial 50number match the arguments. 51.Sh RETURN VALUES 52These functions return a pointer to the first matching certificate or 53.Dv NULL 54if 55.Fa sk 56is 57.Dv NULL 58or does not contain a matching certificate. 59.Sh SEE ALSO 60.Xr ASN1_INTEGER_new 3 , 61.Xr STACK_OF 3 , 62.Xr X509_cmp 3 , 63.Xr X509_get_serialNumber 3 , 64.Xr X509_get_subject_name 3 , 65.Xr X509_NAME_new 3 , 66.Xr X509_new 3 67.Sh HISTORY 68These functions first appeared in SSLeay 0.8.1 and have been available since 69.Ox 2.4 . 70