4,549,091 th visitor since 2017.2.1 ( Today : 5483 )
Programming
No. 784
Name. swindler
Subject. iOS APNS Push JDK 1.7 문제
Main Cate. iOS
Sub Cate. Java
Date. 2017-01-19 16:23
Hit. 5285 (121.78.49.66)
File.
JDK 1.6에서는 잘 작동하던 푸쉬 서버가 JDK 1.7 에서 작동을 안 하는 문제 발생.


javax.net.ssl.SSLException: Received fatal alert: internal_error
at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1991)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1098)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1344)
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:721)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:122)
at java.io.OutputStream.write(OutputStream.java:75)
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:402)
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:350)
at javapns.notification.transmission.NotificationThread.runList(NotificationThread.java:228)
at javapns.notification.transmission.NotificationThread.run(NotificationThread.java:199)
at java.lang.Thread.run(Thread.java:745)




그래서 아래와 같이 해결.

APNS 서버로 연동할 때 SSLHandshakeException이 발생하면 다음과 같이 해보자.

먼저 Apple에서 필요한 파일을 다운 받는다.
인증서 : 확장자가 cer로 끝나는 파일
Private Key : 확장자가 p12로 끝나는 파일
그리고 openssl 명령어를 이용하므로 openssl 명령으로 실행시킬 환경도 준비가 되어야 할것이다.

총 3단계로 openssl 명령어를 실행하며 다음과 같이 진행한다.

인증서 => certification.cer
PrivateKey => private_key.p12

$ openssl x509 -in certification.cer -inform DER -out cert.pem -outform PEM
$ openssl pkcs12 -nocerts -in private_key.p12 -out key.pem
$ openssl pkcs12 -export -inkey key.pem -in cert.pem -out ios.p12


사실 1.6일때 어떻게 작업했는지 기억이 안 나서, 뭐가 달라졌는지도 잘 모르겠음.
하여튼 이렇게 작업하고나니 잘 돌아감.




[바로가기 링크] : http://coolx.net/cboard/develop/784



Name
Password
Comment
Copyright © 1999-2017, swindler. All rights reserved. 367,611 visitor ( 1999.1.8-2004.5.26 ), 2,405,771 ( -2017.01.31)

  2HLAB   2HLAB_Blog   RedToolBox   Omil   Omil_Blog