Hi,
I'm working on the output of method `distinguishedNames` that available under challenge.protectionSpace when my application receieve callback from the server (didReceieveChallenge) of type NSURLAuthenticationMethodClientCertificate. In this case the server ask for certificate from the client that was signed by issuer from the issuersList provided by the server.
The method challenge.protectionSpace.distinguishedNames returns as a DER encoded data, and I wish to decode it and get the issuer distiguished name.
Since openssl is no longer native mac code, i turned to SecAsn1Decode and realized that it also expect to have a template of the DER format (SecAsn1Template).. so I pretty much need to have the formatted layout before I want to decode an instance formatted in this way.
Conceptually, I'm not sure I understand why this template is really needed, because the DER format explain the format by itself.
I've tested my assumption by copying the output of distinguishedNames and using asn.1 online converter to human readble text, and it revealed the format by itself.
here's the input :
30 81 8E 31 0B 30 09 06 03 55 04 06 13 02 49 49
31 0F 30 0D 06 03 55 04 08 0C 06 62 62 62 62 62
6C 31 0C 30 0A 06 03 55 04 07 0C 03 54 4C 56 31
0B 30 09 06 03 55 04 0A 0C 02 54 53 31 1E 30 1C
06 03 55 04 0B 0C 15 43 41 5F 63 65 72 74 69 66
69 63 61 74 65 5F 73 65 72 76 65 72 31 1B 30 19
06 03 55 04 03 0C 12 62 62 62 62 62 73 5F 4D 61
63 42 6F 6F 6B 5F 50 72 6F 31 16 30 14 06 09 2A
86 48 86 F7 0D 01 09 01 16 07 7A 40 7A 2E 63 6F
6D
and the output :
SEQUENCE (7 elem)
OBJECT IDENTIFIER 2.5.4.6 countryName (X.520 DN component)
PrintableString II
OBJECT IDENTIFIER 2.5.4.8 stateOrProvinceName (X.520 DN component)
UTF8String bbbbbl
OBJECT IDENTIFIER 2.5.4.7 localityName (X.520 DN component)
UTF8String TLV
OBJECT IDENTIFIER 2.5.4.10 organizationName (X.520 DN component)
UTF8String TS
OBJECT IDENTIFIER 2.5.4.11 organizationalUnitName (X.520 DN component)
UTF8String CA_certificate_server
OBJECT IDENTIFIER 2.5.4.3 commonName (X.520 DN component)
UTF8String bbbbbs_MacBook_Pro
OBJECT IDENTIFIER 1.2.840.113549.1.9.1 emailAddress (PKCS #9. Deprecated, use an altName extension instead)
So perhaps anyone can thing of a good reason why is the template is needed ? and if so, how do i generate it for my specific example.
Thanks !