|
NAMEASN1_mbstring_copy ,
ASN1_mbstring_ncopy ,
ASN1_STRING_set_by_NID ,
ASN1_STRING_set_default_mask ,
ASN1_STRING_set_default_mask_asc ,
ASN1_STRING_get_default_mask ,
ASN1_tag2bit —
copy a multibyte string into an ASN.1 string object
SYNOPSIS#include <openssl/asn1.h>
int
int
ASN1_STRING *
void
int
unsigned long
unsigned long
DESCRIPTIONASN1_mbstring_copy () interprets
inbytes bytes starting at in as a
multibyte string and copies it to *out, optionally
changing the encoding. If the inbytes argument is
negative, the
strlen(3)
of in is used instead.
The inform argument specifies the character encoding of in:
The bit mask specifies a set of ASN.1 string types that the user is willing to accept:
The first type from the above table that is included in the mask argument and that can represent in is used as the output type. The “default” column indicates whether the type is considered acceptable if the mask argument has the special value 0. The following bit mask constants each include several of the bits listed above:
If out is Otherwise, if *out is
Otherwise, **out is used as the output object. Any data already stored in it is freed and its type is changed to the output type. Finally, in is copied to the output object, changing the character encoding if inform does not match the encoding used by the output type.
If the maskname argument starts with the substring “MASK:”, the rest of it is interpreted as an unsigned long value using strtoul(3).
In typical usage, the calling code calculates the bitwise AND of the return value and a mask describing data types that the calling code is willing to use. If the result of the AND operation is non-zero, the data type is adequate; otherwise, the calling code may need to raise an error. RETURN VALUESASN1_mbstring_copy () and
ASN1_mbstring_ncopy () return the
V_ASN1_* constant representing the output type or -1
if inform is invalid, if inbytes
or in is invalid for the inform
encoding, if in contains an UTF-16 surrogate, which is
unsupported even for input using the UTF-16 encoding, or if memory allocation
fails.
SEE ALSOASN1_PRINTABLE_type(3), ASN1_STRING_new(3), ASN1_STRING_set(3), ASN1_STRING_TABLE_get(3), ASN1_UNIVERSALSTRING_to_string(3)HISTORYASN1_mbstring_copy (),
ASN1_mbstring_ncopy (),
ASN1_STRING_set_by_NID (),
ASN1_STRING_set_default_mask (),
ASN1_STRING_set_default_mask_asc (), and
ASN1_STRING_get_default_mask () first appeared in
OpenSSL 0.9.5 and have been available since OpenBSD
2.7.
BUGSIf integer overflow occurs inASN1_STRING_set_default_mask_asc () while parsing a
number following “MASK:”, the function succeeds, essentially
behaving in the same way as for “default”.
Passing “default” to
Visit the GSP FreeBSD Man Page Interface. |