1.\" $OpenBSD: ASN1_PRINTABLE_type.3,v 1.1 2021/11/15 13:39:40 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: November 15 2021 $ 18.Dt ASN1_PRINTABLE_TYPE 3 19.Os 20.Sh NAME 21.Nm ASN1_PRINTABLE_type 22.Nd classify a single-byte character string 23.Sh SYNOPSIS 24.In openssl/asn1.h 25.Ft int 26.Fo ASN1_PRINTABLE_type 27.Fa "const unsigned char *string" 28.Fa "int len" 29.Fc 30.Sh DESCRIPTION 31.Fn ASN1_PRINTABLE_type 32assumes that the given 33.Fa string 34consists of single-byte characters and classifies it 35according to which kinds characters occur. 36If 37.Fa len 38is greater than 0, at most 39.Fa len 40characters are inspected. 41Otherwise, the 42.Fa string 43needs to be NUL-terminated. 44.Sh RETURN VALUES 45If the given 46.Fa string 47contains a character outside the 48.Xr ascii 7 49range, 50.Fn ASN1_PRINTABLE_type 51returns 52.Dv V_ASN1_T61STRING . 53.Pp 54Otherwise, if it contains a character that is neither a letter 55nor a digit nor the space character 56.Po 57.Ql "\ " , 58ASCII 0x20 59.Pc 60nor the apostrophe quote 61.Po 62.Ql \(aq , 63ASCII 0x27 64.Pc 65nor contained in the set 66.Qq ()+,\-./:=?\& , 67it returns 68.Dv V_ASN1_IA5STRING . 69.Pp 70Otherwise, including if 71.Fa string 72is a 73.Dv NULL 74pointer or points to an empty string, it returns 75.Dv V_ASN1_PRINTABLESTRING . 76.Sh SEE ALSO 77.Xr ASN1_mbstring_copy 3 , 78.Xr ASN1_STRING_new 3 , 79.Xr ASN1_STRING_to_UTF8 3 , 80.Xr isascii 3 , 81.Xr ascii 7 82.Sh HISTORY 83.Fn ASN1_PRINTABLE_type 84first appeared in SSLeay 0.4.5d, has been part of the public API 85since SSLeay 0.5.1, and has been available since 86.Ox 2.4 . 87.Sh CAVEATS 88The ASN.1 notion of what constitutes a 89.Vt PrintableString 90is more restrictive than what the C library function 91.Xr isprint 3 92considers printable. 93