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:

  1. run keychain access; select "login" keychain , "my certificates" category
  2. select certificate name format of "apple development ios push services: ..."
  3. export certificate (in menu, under "file" .. "export items")
  4. export .p12 format.
    contains certificate , private key in encrypted interchange format. next step convert passphrase protected .pem file
  5. 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:

  1. list item
  2. run keychain access application
  3. go system roots
  4. 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

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -