1
Apple의 알림 서버를 인증하기 위해 .p12
파일이 필요합니다. 몇 가지 문제점을 발견했습니다. 내가 알고 있듯이 .csr과 내 컴퓨터를 식별하는 개인 키를 생성해야합니다. 그래서 난 내 로컬 컴퓨터에서이 같은 명령을 실행해야합니다ApnsServiceBuilder를 초기화 할 때 예외가 발생합니다.
*[email protected]:~/Escritorio/curro/certificados$ openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key
Generating a 2048 bit RSA private key
'privateKey.key'가
이제 내 CSR.csr 파일을, 나는에 로그인해야 새로운 개인 키를 작성 :
https://developer.apple.com/account/ios/certificate/certificateCreate.action?formID=62653259
는 내가 전에 생성 된 .csr 파일 이 나에게 .cer 파일 (aps_development.cer)를 제공하는 시스템을 제공한다. 이제이 .cer 파일을 사용하여 .p12 파일을 생성해야합니다. 그러기 위해서는 .cer 파일에서 시작하여 .pem 파일을 만들어야합니다.
Caused by: com.notnoop.exceptions.InvalidSSLConfig: java.io.IOException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded
at com.notnoop.apns.internal.Utilities.newSSLContext(Utilities.java:88)
at com.notnoop.apns.ApnsServiceBuilder.withCert(ApnsServiceBuilder.java:167)
at com.notnoop.apns.ApnsServiceBuilder.withCert(ApnsServiceBuilder.java:134)
at com.kurento.agenda.utils.NotificationServer.init(NotificationServer.java:122)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:346)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:299)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:132)
... 164 more
Caused by: java.io.IOException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded
at sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1304)
at java.security.KeyStore.load(KeyStore.java:1214)
at com.notnoop.apns.internal.Utilities.newSSLContext(Utilities.java:85)
... 174 more
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:811)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:676)
at com.sun.crypto.provider.PKCS12PBECipherCore.implDoFinal(PKCS12PBECipherCore.java:355)
at com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndRC2_40.engineDoFinal(PKCS12PBECipherCore.java:462)
at javax.crypto.Cipher.doFinal(Cipher.java:2087)
at sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1295)
... 176 more
: 여기
@Component
public class NotificationServer implements Runnable, BeanFactoryAware {
@Autowired
// APNS channel
private ApnsService serviceApns;
private String apns_payload;
@PostConstruct
public void init() {
// build apns service path_to_apns_certificate, absolute path .p12 file
String path_to_apns_certificate = config.getProperty("kurento.apns.path");
//pass used to generate the .p12 file
String password_apns_cert = config.getProperty("kurento.apns.path_password");
log.debug("path_to_apns_certificate: " + path_to_apns_certificate);
//keep an eye with this!, this builder is non thread safe!
ApnsServiceBuilder apnsbuilder = new ApnsServiceBuilder();
String sMaxConections = config.getProperty("kurento.apns.maxConections");
log.debug("sMaxConections: " + sMaxConections);
int maxConections = Integer.parseInt(sMaxConections);
apnsbuilder.asPool(maxConections);
String connectWithAppleApns = config.getProperty("kurento.apns.production");
log.debug("connectWithAppleApns: " + connectWithAppleApns);
apnsbuilder.withAppleDestination(new Boolean(connectWithAppleApns));
//here the exception is launched!
apnsbuilder.withCert(path_to_apns_certificate, password_apns_cert);
serviceApns =apnsbuilder.build();
}
}
오류 메시지입니다, 그 후
[email protected]:~/Escritorio/curro/certificados$ openssl pkcs12 -export -inkey privateKey.key -in developer_identity.pem -out iphone_dev.p12
Enter Export Password:
Verifying
Enter Export Password:
나는 .P12 파일을 가지고 내가 ApnsService 인스턴스를 초기화해야 :이 명령입니다
누구나 내 관점을 줄 수 있습니까?
나는 직접 반응한다. 그 오류는 패스 또는 사용자와 관련된 오류를 포함하며, 내 경우에는 따옴표로 저장 한 패스입니다! 그 실수를 보지 못한 날들. – aironman