NAME
ASN1_STRING_TABLE_add
,
ASN1_STRING_TABLE_get
,
ASN1_STRING_TABLE_cleanup
—
maintain the global ASN.1 string
table
SYNOPSIS
#include
<openssl/asn1.h>
int
ASN1_STRING_TABLE_add
(int nid,
long minsize, long maxsize,
unsigned long mask, unsigned long
flags);
ASN1_STRING_TABLE *
ASN1_STRING_TABLE_get
(int
nid);
void
ASN1_STRING_TABLE_cleanup
(void);
DESCRIPTION
The ASN.1 string table is a unique global object. Each entry is of the type ASN1_STRING_TABLE and contains information about one NID object. Some entries are predefined according to RFC 3280 appendix A.1.
By default, the upper bounds for the number of characters in various kinds of ASN1_STRING objects are:
object type | maxsize | symbolic constant |
NID_commonName |
64 | ub_common_name |
NID_countryName |
2 | — |
NID_givenName |
32768 | ub_name |
NID_initials |
32768 | ub_name |
NID_localityName |
128 | ub_locality_name |
NID_name |
32768 | ub_name |
NID_organizationName |
64 | ub_organization_name |
NID_organizationalUnitName |
64 | ub_organization_unit_name |
NID_pkcs9_emailAddress |
128 | ub_email_address |
NID_serialNumber |
64 | ub_serial_number |
NID_stateOrProvinceName |
128 | ub_state_name |
NID_surname |
32768 | ub_name |
The function
ASN1_STRING_TABLE_add
()
changes the existing entry for nid or, if there is
none, allocates a new entry. The fields of the entry are overwritten with
the function arguments of the same name. If minsize or
maxsize is negative or mask is
0, that argument is ignored and the respective field remains unchanged, or
for a new entry, it is set to -1, -1, 0, or
STABLE_FLAGS_MALLOC
, respectively.
The bits set in the flags argument are OR'ed
into the existing field rather than overwriting it. The only useful flag is
STABLE_NO_MASK
. If it is set,
ASN1_STRING_set_by_NID(3) skips applying the global mask that
can be set with
ASN1_STRING_set_default_mask(3). Otherwise, the table entry
only accepts types permitted by both the global mask and the
mask argument. Setting
STABLE_FLAGS_MALLOC
or any other bit in the
mask argument has no effect.
The function
ASN1_STRING_TABLE_get
()
retrieves the entry for nid.
The function
ASN1_STRING_TABLE_cleanup
()
removes and frees all entries except the predefined ones and restores the
predefined ones to their default state.
RETURN VALUES
The ASN1_STRING_TABLE_add
() function
returns 1 if successful; otherwise 0 is returned and an error code can be
retrieved with
ERR_get_error(3).
ASN1_STRING_TABLE_get
() returns a valid
ASN1_STRING_TABLE structure or
NULL
if nothing is found.
SEE ALSO
ASN1_OBJECT_new(3), ASN1_STRING_set_by_NID(3), OBJ_create(3), OBJ_nid2obj(3)
HISTORY
ASN1_STRING_TABLE_add
(),
ASN1_STRING_TABLE_get
(), and
ASN1_STRING_TABLE_cleanup
() first appeared in
OpenSSL 0.9.5 and have been available since OpenBSD
2.7.
BUGS
Most aspects of the semantics considerably differ from OpenSSL.