OpenSSL ASN1_STRING_length(3openssl)
NNNNAAAAMMMMEEEEASN1_STRING_dup, ASN1_STRING_cmp, ASN1_STRING_set,
ASN1_STRING_length, ASN1_STRING_length_set,
ASN1_STRING_type, ASN1_STRING_data - ASN1_STRING utility
functions SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS#include
int ASN1_STRING_length(ASN1_STRING *x);
unsigned char * ASN1_STRING_data(ASN1_STRING *x);
ASN1_STRING * ASN1_STRING_dup(ASN1_STRING *a);
int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b);
int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
int ASN1_STRING_type(ASN1_STRING *x);
int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNThese functions allow an AAAASSSSNNNN1111_SSSSTTTTRRRRIIIINNNNGGGG structure to be
manipulated.ASN1_STRING_length() returns the length of the content of xxxx.
ASN1_STRING_data() returns an internal pointer to the data
of xxxx. Since this is an internal pointer it should nnnnooootttt be freed or modified in any way.ASN1_STRING_dup() returns a copy of the structure aaaa.
ASN1_STRING_cmp() compares aaaa and bbbb returning 0 if the two
are identical. The string types and content are compared.ASN1_STRING_set() sets the data of string ssssttttrrrr to the buffer
ddddaaaattttaaaa or length lllleeeennnn. The supplied data is copied. If lllleeeennnn is-1 then the length is determined by strlen(data).
ASN1_STRING_type() returns the type of xxxx, using standard
constants such as VVVV_AAAASSSSNNNN1111_OOOOCCCCTTTTEEEETTTT_SSSSTTTTRRRRIIIINNNNGGGG.
ASN1_STRING_to_UTF8() converts the string iiiinnnn to UTF8 format,
the converted data is allocated in a buffer in ****oooouuuutttt. The length of oooouuuutttt is returned or a negative error code. Thebuffer ****oooouuuutttt should be free using OPENSSL_free().
NNNNOOOOTTTTEEEESSSS Almost all ASN1 types in OpenSSL are represented as an27/Mar/2010 Last change: 0.9.8o 1
OpenSSL ASN1_STRING_length(3openssl)
AAAASSSSNNNN1111_SSSSTTTTRRRRIIIINNNNGGGG structure. Other types such as AAAASSSSNNNN1111_OOOOCCCCTTTTEEEETTTT_SSSSTTTTRRRRIIIINNNNGGGG
are simply typedefed to AAAASSSSNNNN1111_SSSSTTTTRRRRIIIINNNNGGGG and the functions call
the AAAASSSSNNNN1111_SSSSTTTTRRRRIIIINNNNGGGG equivalents. AAAASSSSNNNN1111_SSSSTTTTRRRRIIIINNNNGGGG is also used for
some CCCCHHHHOOOOIIIICCCCEEEE types which consist entirely of primitive string types such as DDDDiiiirrrreeeeccccttttoooorrrryyyySSSSttttrrrriiiinnnngggg and TTTTiiiimmmmeeee. These functions should nnnnooootttt be used to examine or modifyAAAASSSSNNNN1111_IIIINNNNTTTTEEEEGGGGEEEERRRR or AAAASSSSNNNN1111_EEEENNNNUUUUMMMMEEEERRRRAAAATTTTEEEEDDDD types: the relevant IIIINNNNTTTTEEEEGGGGEEEERRRR
or EEEENNNNUUUUMMMMEEEERRRRAAAATTTTEEEEDDDD utility functions should be used instead. In general it cannot be assumed that the data returned byASN1_STRING_data() is null terminated or does not contain
embedded nulls. The actual format of the data will depend on the actual string type itself: for example for and IA5String the data will be ASCII, for a BMPString two bytes per character in big endian format, UTF8String will be in UTF8 format. Similar care should be take to ensure the data is in thecorrect format when calling ASN1_STRING_set().
RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEESSSS SSSSEEEEEEEE AAAALLLLSSSSOOOOERR_get_error(3)
HHHHIIIISSSSTTTTOOOORRRRYYYY27/Mar/2010 Last change: 0.9.8o 2