1.\" $OpenBSD: X509_get1_email.3,v 1.1 2019/08/23 12:23:39 schwarze Exp $ 2.\" 3.\" Copyright (c) 2019 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: August 23 2019 $ 18.Dt X509_GET1_EMAIL 3 19.Os 20.Sh NAME 21.Nm X509_get1_email , 22.Nm X509_get1_ocsp , 23.Nm X509_email_free 24.Nd utilities for stacks of strings 25.Sh SYNOPSIS 26.In openssl/x509v3.h 27.Vt typedef char *OPENSSL_STRING ; 28.Ft STACK_OF(OPENSSL_STRING) * 29.Fo X509_get1_email 30.Fa "X509 *certificate" 31.Fc 32.Ft STACK_OF(OPENSSL_STRING) * 33.Fo X509_get1_ocsp 34.Fa "X509 *certificate" 35.Fc 36.Ft void 37.Fo X509_email_free 38.Fa "STACK_OF(OPENSSL_STRING) *stack" 39.Fc 40.Sh DESCRIPTION 41.Fn X509_get1_email 42retrieves all email addresses from the 43.Fa subject 44field and from any 45Subject Alternative Name extension of the 46.Fa certificate . 47.Pp 48.Fn X509_get1_ocsp 49retrieves all uniform resource identifiers 50from all 51.Vt AccessDescription 52objects having an 53.Fa accessMethod 54of OCSP which are contained in the Authority Information Access extension 55of the 56.Fa certificate . 57.Pp 58.Fn X509_email_free 59frees all strings stored in the 60.Fa stack 61as well as the stack itself. 62If 63.Fa stack 64is a 65.Dv NULL 66pointer, no action occurs. 67.Sh RETURN VALUES 68.Fn X509_REQ_get1_email 69and 70.Fn X509_get1_ocsp 71return newly allocated stacks of 72.Vt char * 73containing copies of the addresses in question, or 74.Dv NULL 75if there are no addresses or if an error occurs. 76.Sh SEE ALSO 77.Xr OCSP_sendreq_new 3 , 78.Xr OCSP_SERVICELOC_new 3 , 79.Xr OPENSSL_sk_new 3 , 80.Xr STACK_OF 3 , 81.Xr X509_check_email 3 , 82.Xr X509_get_ext_d2i 3 , 83.Xr X509_get_subject_name 3 , 84.Xr X509_new 3 , 85.Xr x509v3.cnf 5 86.Sh STANDARDS 87RFC 5280: Internet X.509 Public Key Infrastructure Certificate and 88Certificate Revocation List (CRL) Profile 89.Bl -dash -offset indent -compact 90.It 91section 4.1: Basic Certificate Fields 92.It 93section 4.1.2.6: Subject 94.It 95section 4.2.1.6: Subject Alternative Name 96.It 97section 4.2.2.1: Authority Information Access 98.El 99.Pp 100RFC 2985: PKCS #9: Selected Object Classes and Attribute Types 101.Bl -dash -offset indent -compact 102.It 103section 5.2.1: Electronic-mail address 104.It 105appendix B.3.5: emailAddress 106.El 107.Sh HISTORY 108.Fn X509_get1_email 109and 110.Fn X509_email_free 111first appeared in OpenSSL 0.9.6 and have been available since 112.Ox 2.9 . 113.Pp 114.Fn X509_get1_ocsp 115first appeared in OpenSSL 0.9.8h and has been available since 116.Ox 4.5 . 117.Sh BUGS 118.Fn X509_email_free 119is utterly misnamed. 120It does not operate on any 121.Vt X509 122object, nor is it in any way restricted to email addresses; 123instead, it simply frees a stack of strings. 124