1ASN1_STRING_length(3)               OpenSSL              ASN1_STRING_length(3)
2
3
4

NAME

6       ASN1_STRING_dup, ASN1_STRING_cmp, ASN1_STRING_set, ASN1_STRING_length,
7       ASN1_STRING_length_set, ASN1_STRING_type, ASN1_STRING_data,
8       ASN1_STRING_to_UTF8 - ASN1_STRING utility functions
9

SYNOPSIS

11        #include <openssl/asn1.h>
12
13        int ASN1_STRING_length(ASN1_STRING *x);
14        unsigned char * ASN1_STRING_data(ASN1_STRING *x);
15
16        ASN1_STRING * ASN1_STRING_dup(ASN1_STRING *a);
17
18        int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b);
19
20        int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
21
22        int ASN1_STRING_type(ASN1_STRING *x);
23
24        int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);
25

DESCRIPTION

27       These functions allow an ASN1_STRING structure to be manipulated.
28
29       ASN1_STRING_length() returns the length of the content of x.
30
31       ASN1_STRING_data() returns an internal pointer to the data of x.  Since
32       this is an internal pointer it should not be freed or modified in any
33       way.
34
35       ASN1_STRING_dup() returns a copy of the structure a.
36
37       ASN1_STRING_cmp() compares a and b returning 0 if the two are
38       identical. The string types and content are compared.
39
40       ASN1_STRING_set() sets the data of string str to the buffer data or
41       length len. The supplied data is copied. If len is -1 then the length
42       is determined by strlen(data).
43
44       ASN1_STRING_type() returns the type of x, using standard constants such
45       as V_ASN1_OCTET_STRING.
46
47       ASN1_STRING_to_UTF8() converts the string in to UTF8 format, the
48       converted data is allocated in a buffer in *out. The length of out is
49       returned or a negative error code. The buffer *out should be free using
50       OPENSSL_free().
51

NOTES

53       Almost all ASN1 types in OpenSSL are represented as an ASN1_STRING
54       structure. Other types such as ASN1_OCTET_STRING are simply typedefed
55       to ASN1_STRING and the functions call the ASN1_STRING equivalents.
56       ASN1_STRING is also used for some CHOICE types which consist entirely
57       of primitive string types such as DirectoryString and Time.
58
59       These functions should not be used to examine or modify ASN1_INTEGER or
60       ASN1_ENUMERATED types: the relevant INTEGER or ENUMERATED utility
61       functions should be used instead.
62
63       In general it cannot be assumed that the data returned by
64       ASN1_STRING_data() is null terminated or does not contain embedded
65       nulls. The actual format of the data will depend on the actual string
66       type itself: for example for an IA5String the data will be ASCII, for a
67       BMPString two bytes per character in big endian format, and for an
68       UTF8String it will be in UTF8 format.
69
70       Similar care should be take to ensure the data is in the correct format
71       when calling ASN1_STRING_set().
72

RETURN VALUES

SEE ALSO

75       ERR_get_error(3)
76

HISTORY

781.0.2o                            2019-09-10             ASN1_STRING_length(3)
Impressum