I'm using a specific certificate profile which includes a user-defined attribute
"serialNumber" in the subject.
An example subject looks like this:
Subject: serialNumber=Z000805N, GN=Thomas, SN=Kraemmer, O=Siemens, CN=Kraemmer Thomas
The common name is not unique but the serialNumber is so I have to use the latter
one for authentication.
Getting the CN is quite easy:
/*
* Get the Common Name
*/
X509_NAME_get_text_by_NID(X509_get_subject_name(client_cert),
NID_commonName, buf, 256);
But how do I extract the attribute serialNumber from the subject as there is no NID defined
for this?
Is there a structured way to extract user-defined fields or do I have to use string
functions on the textual representation of the subject?
Any help is greatly appreciated!
--
Best regards / Gruesse
Thomas Kraemmer