I'm developing an iOS app wich uses a third-party framework and SSL.
In order to connect to the server i need to pass a server certificate, a client certificate and a passphrase:
[HostConfiguration hostConfigurationWithAddress:@"demo.server...."
port:743
securedWithSSL:YES
serverCertPath:[[NSBundle mainBundle] pathForResource:@"SERVER-CERT" ofType:@"der"]
clientCertChainPath:[[NSBundle mainBundle] pathForResource:@"CLIENT-CERT" ofType:@"p12"]
chainPassphrase:@"ABCDEFG"];
So, i requested the certificates from their support to connect and they send me a zip file (i'm using a mac):
- chain_2016.pem (mac identifies as "Root")
- passphrase
- yourCertificate.pem ("Standard")
- yourCertificate.p12 ("Personal")
The passphrase file contains two strings, the passphrase for the p12 file and a 32 characters long string wich i do not know what it is for. It looks something like this: 53CFE0E1914EF853E148F29C0A56B716
I know the p12 file and the passphrase are correct.But what confuses me are the two PEM files where i only need one DER encoded certificate. I tried to convert each PEM to DER using
openssl x509 -in ...
But it did not work...
I printed out the content of both chain_2016
and yourCertificate.pem
and noticed that yourCertificate.pem
contains chain_2016
plus two extra certs.
chain_2016.pem
cat chain_2016.pem
-----BEGIN CERTIFICATE-----
MIIERTCCAy2gAwIBAgIINQskOyELGawwDQYJKoZIhvcNAQEFBQAwga8xHjAcBgkq
[...]
VPEpWKH17rzBvmktsDjqo1Zch8xiWSzP0DnJJw13Zn/cPwBJkHY0LPA=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIFSzCCBDOgAwIBAgIIPuhYaSjrBR8wDQYJKoZIhvcNAQEFBQAwga8xHjAcBgkq
[...]
ZeitvrwyCtzVo7NWb+Zf
-----END CERTIFICATE-----
yourCertificate.pem
cat yourCertificate.pem
Bag Attributes
localKeyID: 2E EC 57 1C 31 82 6D 82 68 59 86 93 FB FA 65 16 58 85 21 22
friendlyName: myApp.test.client
Key Attributes: <No Attributes>
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCu9UVuZyLsOc5u
[...]
zoQQfIreqU9KN4nhmZLKR0zY
-----END PRIVATE KEY-----
Bag Attributes
localKeyID: 2E EC 57 1C 31 82 6D 82 68 59 86 93 FB FA 65 16 58 85 21 22
friendlyName: myApp.test.client
...Here some other info like subject/email etc...
-----BEGIN CERTIFICATE-----
MIIHljCCBX6gAwIBAgIIETxy2amJI0cwDQYJKoZIhvcNAQENBQAwgbUxHjAcBgkq
[...]
hdAq5P+vcHfD8cGOdI61yJB2PgJg67lWviU=
-----END CERTIFICATE-----
Bag Attributes
friendlyName: CompanyName Meta ROOT CA TEST
...Again some other info like subject/email etc...
-----BEGIN CERTIFICATE-----
MIIERTCCAy2gAwIBAgIINQskOyELGawwDQYJKoZIhvcNAQEFBQAwga8xHjAcBgkq
[This is the same as one of the certificates in chain_2016]
VPEpWKH17rzBvmktsDjqo1Zch8xiWSzP0DnJJw13Zn/cPwBJkHY0LPA=
-----END CERTIFICATE-----
Bag Attributes
friendlyName: CompanyName SUB TEST ROOT CA 1
...Again some other info like subject/email etc...
-----BEGIN CERTIFICATE-----
MIIFSzCCBDOgAwIBAgIIPuhYaSjrBR8wDQYJKoZIhvcNAQEFBQAwga8xHjAcBgkq
[Second certificate in chain_2016]
ZeitvrwyCtzVo7NWb+Zf
-----END CERTIFICATE-----
Since this is my first time working with SSL my hope is that somebody could help me. Thanks !
UPDATE:
Thanks pedrofb, as i said, i already tried:
I tried to convert each PEM to DER using
openssl x509 -in ...
But it did not work...
There are two steps in using this framework. First, establish a connection to the server and then perform an action. Using either of the converted DER-Files allows me to connect, but when i try to perform an action (eg. login) i get "You are not authorized for this action". Does this mean everything is OK with the certificates and the error comes from somewhere else unrelated to SSL?