From 2bc51ed3c085538cc4c2be13c353b6c5e5b679dd Mon Sep 17 00:00:00 2001 From: schwarze Date: Sun, 4 Jul 2021 12:56:27 +0000 Subject: [PATCH] document X509_find_by_subject(3) and X509_find_by_issuer_and_serial(3) --- lib/libcrypto/man/Makefile | 3 +- lib/libcrypto/man/X509_find_by_subject.3 | 69 ++++++++++++++++++++++++ lib/libcrypto/man/X509_new.3 | 5 +- 3 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 lib/libcrypto/man/X509_find_by_subject.3 diff --git a/lib/libcrypto/man/Makefile b/lib/libcrypto/man/Makefile index 0d39580971b..2087fbae707 100644 --- a/lib/libcrypto/man/Makefile +++ b/lib/libcrypto/man/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.171 2020/07/23 17:34:53 schwarze Exp $ +# $OpenBSD: Makefile,v 1.172 2021/07/04 12:56:27 schwarze Exp $ .include @@ -307,6 +307,7 @@ MAN= \ X509_cmp.3 \ X509_cmp_time.3 \ X509_digest.3 \ + X509_find_by_subject.3 \ X509_get_pubkey.3 \ X509_get_serialNumber.3 \ X509_get_subject_name.3 \ diff --git a/lib/libcrypto/man/X509_find_by_subject.3 b/lib/libcrypto/man/X509_find_by_subject.3 new file mode 100644 index 00000000000..98a76a1fcac --- /dev/null +++ b/lib/libcrypto/man/X509_find_by_subject.3 @@ -0,0 +1,69 @@ +.\" $OpenBSD: X509_find_by_subject.3,v 1.1 2021/07/04 12:56:27 schwarze Exp $ +.\" +.\" Copyright (c) 2021 Ingo Schwarze +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: July 4 2021 $ +.Dt X509_FIND_BY_SUBJECT 3 +.Os +.Sh NAME +.Nm X509_find_by_subject , +.Nm X509_find_by_issuer_and_serial +.Nd search an array of X.509 certificates +.Sh SYNOPSIS +.In openssl/x509.h +.Ft X509 * +.Fo X509_find_by_subject +.Fa "STACK_OF(X509) *sk" +.Fa "X509_NAME *subject" +.Fc +.Ft X509 * +.Fo X509_find_by_issuer_and_serial +.Fa "STACK_OF(X509) *sk" +.Fa "X509_NAME *issuer" +.Fa "ASN1_INTEGER *serial" +.Fc +.Sh DESCRIPTION +.Fn X509_find_by_subject +searches the variable-sized array +.Fa sk +for a certificate with a matching +.Fa subject +name. +.Pp +.Fn X509_find_by_issuer_and_serial +searches the array for a certificate where both the +.Fa issuer +name and the +.Fa serial +number match the arguments. +.Sh RETURN VALUES +These functions return a pointer to the first matching certificate or +.Dv NULL +if +.Fa sk +is +.Dv NULL +or does not contain a matching certificate. +.Sh SEE ALSO +.Xr ASN1_INTEGER_new 3 , +.Xr STACK_OF 3 , +.Xr X509_cmp 3 , +.Xr X509_get_serialNumber 3 , +.Xr X509_get_subject_name 3 , +.Xr X509_NAME_new 3 , +.Xr X509_new 3 +.Sh HISTORY +These functions first appeared in SSLeay 0.8.1 and have been available since +.Ox 2.4 . diff --git a/lib/libcrypto/man/X509_new.3 b/lib/libcrypto/man/X509_new.3 index 4ee31a67d25..ea097bc8662 100644 --- a/lib/libcrypto/man/X509_new.3 +++ b/lib/libcrypto/man/X509_new.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: X509_new.3,v 1.22 2019/08/23 12:23:39 schwarze Exp $ +.\" $OpenBSD: X509_new.3,v 1.23 2021/07/04 12:56:27 schwarze Exp $ .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 .\" .\" This file is a derived work. @@ -66,7 +66,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: August 23 2019 $ +.Dd $Mdocdate: July 4 2021 $ .Dt X509_NEW 3 .Os .Sh NAME @@ -181,6 +181,7 @@ if an error occurs. .Xr X509_CRL_new 3 , .Xr X509_digest 3 , .Xr X509_EXTENSION_new 3 , +.Xr X509_find_by_subject 3 , .Xr X509_get0_notBefore 3 , .Xr X509_get0_signature 3 , .Xr X509_get1_email 3 , -- 2.20.1