Manual Pages for UNIX Darwin command on man OBJ_nid2sn
MyWebUniversity

Manual Pages for UNIX Darwin command on man OBJ_nid2sn

OBJnid2obj(3) OpenSSL OBJnid2obj(3)

NAME

OBJnid2obj, OBJnid2ln, OBJnid2sn, OBJobj2nid, OBJtxt2nid, OBJln2nid, OBJsn2nid, OBJcmp, OBJdup, OBJtxt2obj, OBJobj2txt,

OBJcreate, OBJcleanup - ASN1 object utility functions

SYNOPSIS

ASN1OBJECT * OBJnid2obj(int n); const char * OBJnid2ln(int n); const char * OBJnid2sn(int n); int OBJobj2nid(const ASN1OBJECT *o); int OBJln2nid(const char *ln); int OBJsn2nid(const char *sn); int OBJtxt2nid(const char *s); ASN1OBJECT * OBJtxt2obj(const char *s, int noname); int OBJobj2txt(char *buf, int buflen, const ASN1OBJECT *a, int noname); int OBJcmp(const ASN1OBJECT *a,const ASN1OBJECT *b); ASN1OBJECT * OBJdup(const ASN1OBJECT *o); int OBJcreate(const char *oid,const char *sn,const char *ln); void OBJcleanup(void);

DESCRIPTION

The ASN1 object utility functions process ASN1OBJECT structures which are a representation of the ASN1 OBJECT IDENTIFIER (OID) type. OBJnid2obj(), OBJnid2ln() and OBJnid2sn() convert the NID nn to an ASN1OBJECT structure, its long name and its short name respectively, or NNUULLLL is an error occurred. OBJobj2nid(), OBJln2nid(), OBJsn2nid() return the corresponding NID for the object oo, the long name or the short name respectively or NIDundef if an error occurred. OBJtxt2nid() returns NID corresponding to text string . ss can be a long name, a short name or the numerical respresentation of an object. OBJtxt2obj() converts the text string ss into an ASN1OBJECT structure. If nnoonnaammee is 0 then long names and short names will be interpreted as well as numerical forms. If nnoonnaammee is 1 only the numerical form is acceptable. OBJobj2txt() converts the AASSNN11OOBBJJEECCTT aa into a textual representation. The representation is written as a null terminated string to bbuuff at most bbuufflleenn bytes are written, truncating the result if necessary. The total amount of space required is returned. If nnoonnaammee is 0 then if the object has a long or short name then that will be used, otherwise the numerical form will be used. If nnoonnaammee is 1 then the numerical form will always be used. OBJcmp() compares aa to bb. If the two are identical 0 is returned. OBJdup() returns a copy of oo. OBJcreate() adds a new object to the internal table. ooiidd is the numerical form of the object, ssnn the short name and llnn the long name. A new NID is returned for the created object. OBJcleanup() cleans up OpenSSLs internal object table: this should be called before an application exits if any new objects were added using OBJcreate(). NNOOTTEESS Objects in OpenSSL can have a short name, a long name and a numerical identifier (NID) associated with them. A standard set of objects is represented in an internal table. The appropriate values are defined in the header file oobbjjeeccttss..hh. For example the OID for commonName has the following definitions:

#define SNcommonName "CN"

#define LNcommonName "commonName"

#define NIDcommonName 13

New objects can be added by calling OBJcreate(). Table objects have certain advantages over other objects: for example their NIDs can be used in a C language switch statement. They are also static constant structures which are shared: that is there is only a single constant structure for each table object. Objects which are not in the table have the NID value NIDundef. Objects do not need to be in the internal tables to be processed, the functions OBJtxt2obj() and OBJobj2txt() can process the numerical form of an OID. EEXXAAMMPPLLEESS Create an object for ccoommmmoonnNNaammee: ASN1OBJECT *o; o = OBJnid2obj(NIDcommonName); Check if an object is ccoommmmoonnNNaammee if (OBJobj2nid(obj) == NIDcommonName) /* Do something */ Create a new NID and initialize an object from it: int newnid; ASN1OBJECT *obj; newnid = OBJcreate("1.2.3.4", "NewOID", "New Object Identifier"); obj = OBJnid2obj(newnid); Create a new object directly: obj = OBJtxt2obj("1.2.3.4", 1);

BUGS

OBJobj2txt() is awkward and messy to use: it doesn't follow the convention of other OpenSSL functions where the buffer can be set to NNUULLLL to determine the amount of data that should be written. Instead bbuuff must point to a valid buffer and bbuufflleenn should be set to a positive value. A buffer length of 80 should be more than enough to handle any OID encountered in practice.

RETURN VALUES

OBJnid2obj() returns an AASSNN11OOBBJJEECCTT structure or NNUULLLL is an error occurred. OBJnid2ln() and OBJnid2sn() returns a valid string or NNUULLLL on error. OBJobj2nid(), OBJln2nid(), OBJsn2nid() and OBJtxt2nid() return a NID or NNIIDDuunnddeeff on error.

SEE ALSO

ERRgeterror(3) HISTORY TBA

0.9.7l 2002-10-20 OBJnid2obj(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™