ssl - Couldn't able to connect to APNS Sandbox server -
i trying connect apple apns server following observations:
1)port 2195 open 2)with valid key passphrase apns_sslcertificate_key.pem 3)entrust certificate (2048) downloaded https://www.entrust.net/downloads/binary/entrust_ssl_ca.cer
4)with successful telnet response below :
$ telnet gateway.sandbox.push.apple.com 2195 trying 17.172.232.226... connected gateway.sandbox.push-apple.com.akadns.net. escape character '^]'.
but when run following openssl command in server test apns connectivity :
openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert apns_sslcertificate_key.pem -debug -showcerts -cafile server-ca-cert.pem
i getting error follows:
unable load certificate 57013:error:0906d06c:pem routines:pem_read_bio:no start line:/sourcecache/openssl098/openssl098-35/src/crypto/pem/pem_lib.c:650:expecting: trusted certificate
so please suggest how resolve problem
thanks in advance ......
i ran same issue; resolved error re-export entrust certificate system roots of os/x keychain access application.
to complete, i'll give complete explanation of how created key/cert files (something should have been in apple's technote 2265: https://developer.apple.com/library/content/technotes/tn2265/_index.html)
creating apn-cert-and-key:
- run keychain access; select "login" keychain , "my certificates" category
- select certificate name format of "apple development ios push services: ..."
- export certificate (in menu, under "file" .. "export items")
- export .p12 format.
contains certificate , private key in encrypted interchange format. next step convert passphrase protected .pem file using terminal, execute following command (using own filenames, of course):
openssl pkcs12 -in pushcertkey.p12 -out pushcertkey.pem
(you need enter password .p12 file , provide passphrase .pem file.)if really really don't want passphrase on .pem file, try:
openssl pkcs12 -in pushcertkey.p12 -out pushcertkeynocrypt.pem -nodes
creating ca certificate file:
- list item
- run keychain access application
- go system roots
- export certificate named "entrust.net certification authority (2048)" .pem file.
note: roots container has 4 entrust certificates; 2 of them name "entrust.net certification authority (2048)" (but different certificate extensions, via info). both of "entrust.net certification authority (2048)" certificates effective in validating trust chain; other 2 entrust certificates did not work. more significantly, entrust certificate pointed @ apple technote 2265 not work.
make sure export .pem format; default .cer , step easy miss.
run verification command:
openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert pushcertkey.pem -debug -showcerts -cafile "entrust.net certification authority (2048).pem"
this server , process assume connecting apple's dev sandbox apn server; if trying use production apn server, need use correct server , port.
for more information on openssl, suggest following pages:
Comments
Post a Comment