X509_NAME_GET_INDEX_BY_NID(3ssl) OpenSSL X509_NAME_GET_INDEX_BY_NID(3ssl) X509_NAME_get_index_by_NID, X509_NAME_get_index_by_OBJ, X509_NAME_get_entry, X509_NAME_entry_count, X509_NAME_get_text_by_NID, X509_NAME_get_text_by_OBJ - X509_NAME #include int X509_NAME_get_index_by_NID(const X509_NAME *name, int nid, int lastpos); int X509_NAME_get_index_by_OBJ(const X509_NAME *name, const ASN1_OBJECT *obj, int lastpos); int X509_NAME_entry_count(const X509_NAME *name); X509_NAME_ENTRY *X509_NAME_get_entry(const X509_NAME *name, int loc); int X509_NAME_get_text_by_NID(const X509_NAME *name, int nid, char *buf, int len); int X509_NAME_get_text_by_OBJ(const X509_NAME *name, const ASN1_OBJECT *obj, char *buf, int len); X509_NAME. X509_NAME Name RFC 5280 ( ) . X509_NAME_get_index_by_NID() X509_NAME_get_index_by_OBJ() nid obj lastpos. lastpos -1. -1. nid ( OID ) -2. X509_NAME_entry_count() name. X509_NAME_get_entry() X509_NAME_ENTRY name loc. loc 0 (X509_NAME_entry_count(name) - 1). . X509_NAME_get_text_by_NID() X509_NAME_get_text_by_OBJ() "" name nid obj -1. len buf . . buf buf ( ). X509_NAME_get_text_by_NID() X509_NAME_get_text_by_OBJ() . : BMPString UTF8String. X509_NAME_get_index_by_NID() X509_NAME_get_index_by_OBJ() X509_NAME_get_entry() X509_NAME_ENTRY . NID_* OBJ_* codes / . NIDs X509_NAME_get_index_by_NID() -2. NID OBJ_nid2obj(nid) NULL. X509_NAME_get_index_by_NID() X509_NAME_get_index_by_OBJ() -1 . X509_NAME_get_index_by_NID() -2 NID . X509_NAME_entry_count() 0 . X509_NAME_get_entry() X509_NAME NULL . : int i; X509_NAME_ENTRY *e; for (i = 0; i < X509_NAME_entry_count(nm); i++) { e = X509_NAME_get_entry(nm, i); /* Do something with e */ } commonName: int lastpos = -1; X509_NAME_ENTRY *e; for (;;) { lastpos = X509_NAME_get_index_by_NID(nm, NID_commonName, lastpos); if (lastpos == -1) break; e = X509_NAME_get_entry(nm, lastpos); /* Do something with e */ } ERR_get_error(3) d2i_X509_NAME(3) 2002-2025 OpenSSL. . Apache 2.0 ( ""). . LICENSE . 3 . . : . 3.6.2 7 2026 X509_NAME_GET_INDEX_BY_NID(3ssl)