Push 기능 구현중에 ATP 서버에 올린  Push 실행시 동작이 잘되나

로컬에서Push 실행시, 아이폰 푸시처리 중에 에러가 발생했던 부분에 대한 해결방법이다.

 

에러 발생 부분 : /??/??/??/IPhonePush.java, 73 line

 

pushManager.initializeConnection(host, port, certificateStream, certificatePassword,

            SSLConnectionHelper.KEYSTORE_TYPE_PKCS12);


에러 메시지

 

java.io.IOException: exception decrypting data - java.security.InvalidKeyException: Illegal key size

또는

java.io.IOException: exception decrypting data - java.security.InvalidKeyException: default parameters

 

 

원인 : JDK 1.4.x부터는 JCE가 기본적으로 포함이 되어 있으며 미국 수출 통상법에 따라 사용할 수 있는 키 길이 등에 제한이 걸려 있다.

Within the libraries of the Java Cryptography Extension (JCE), you'll find support for encryption, decryption, key agreement, Message Authentication Code (MAC), and some other cryptographic services. Due to import control restrictions of some countries, the JCE jurisdiction policy files shipped with the Java 2 SDK, release 1.4 allow "strong" but limited cryptography to be used. An "unlimited strength" version of these files indicating no restrictions on cryptographic strengths is available for those living in eligible countries (most countries). You can download this version and replace the string cryptography versions supplied with the Java 2 SDK, release 1.4 with the unlimited ones.


해결방법 : 제한이 없는 정책파일로 변경하면 된다.

 

https://t1.daumcdn.net/cfile/tistory/1934EE4C4F19243E02



오라클 홈페이지에 다운로드로 가셔서
 Java for Developers 로 이동합니다.

https://t1.daumcdn.net/cfile/tistory/1134EE4C4F19243F03


다운로드 탭을 선택 후 아래쪽으로 쭈~욱 이동하시면

https://t1.daumcdn.net/cfile/tistory/1234EE4C4F19243F04

http://www.oracle.com/technetwork/java/javase/downloads/index.html (페이지 최하단)


위와 같이 제한없는 정책파일을 다운받으실 수 있다
알맞은 정책파일을 다운 받는다

JDK
 JRE가 설치된 곳의 해당 위치에 있는 다음 파일을 덮어 쓰면 됩다.
=> C:\Program Files\Java\jdk1.6.0_29\jre\lib\security
=> C:\Program Files\Java\jre6\lib\security

정책파일
 : local_policy.jar, US_export_policy.jar

제한 정책 파일에 의해 허가된 최대 키 사이즈

Algorithm

Maximum Keysize

DES

64

DESede

*

RC2

128

RC4

128

RC5

128

RSA

*

all others

128


Java  Cryptography Architecture (JCA) Reference Guide
http://docs.oracle.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html

 

 

Posted by CJ.Ree
,