I want to get TaxNumber in Cert Token

#40234
Posted: 02/14/2018 04:33:22
by Thitima BuaKampa (Basic support level)
Joined: 01/30/2018
Posts: 7

I want to get TaxNumber in Cert Token. This Picture in Subject
2.5.4.97 =0105546018274
In Code :-
TElX509Certificate Cert = _PKCS11CertStorage.get_Certificates(i);
Cert.SubjectName. It' not have value "0105546018274"

Do you have example code get Value TaxNumber?
Thanks.
#40235
Posted: 02/14/2018 04:37:33
by Thitima BuaKampa (Basic support level)
Joined: 01/30/2018
Posts: 7

picture


#40236
Posted: 02/14/2018 06:04:14
by Eugene Mayevski (Team)

You need to inspect OIDs and Values of SubjectRDN property of the certificate. OIDs are integer. If you know only the OID text as on the screenshot, you can convert it to binary using StrToOID function from SBConstants namespace . This function will give you the binary array, which you can use for comparing Certificate.SubjectRDN.get_OIDs(x) with it.

Once you find the index of your needed OID, use this index to read Certificate.SubjectRDN.Values property. That value also will be binary , and its contents are application-specific (we can't know, how to treat it, so we give it away in binary).


Sincerely yours
Eugene Mayevski
#40238
Posted: 02/14/2018 22:24:56
by Thitima BuaKampa (Basic support level)
Joined: 01/30/2018
Posts: 7

I got it, Thank you.

byte[] sn = Cert.SubjectRDN.get_Values(1);
snstr = Encoding.UTF8.GetString(sn);
#40239
Posted: 02/15/2018 02:45:42
by Eugene Mayevski (Team)

Hardcoding the index is doable for the specific certificate, but in general, it's better to do the lookup as I described above.


Sincerely yours
Eugene Mayevski

Reply

Statistics

Topic viewed 75 times

Number of guests: 1, registered members: 0, in total hidden: 0





Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!