Comments (4)
Hey cbenazza.
First, you don't need to (re-)export everything as PEM files. jPasskit is designed to work with the default files, Apple delivers/OS X exports. That means DER for the WWDR CA file and PKCS12 for the certificate and key you export from your Keychain.
This PKCS12 file is the one you can use as keystore.
Example:
String keyStorePath = "/passbook/src/main/resources/pem/Certificates.p12";
String keyStorePassword = "test2";
PKSigningInformation pkSigningInformation = PKSigningUtil.loadSigningInformationFromPKCS12FileAndIntermediateCertificateFile(
keyStorePath, keyStorePassword, APPLE_WWDRCA);
from jpasskit.
Thanks but I tried before but I had another error. Do you have any idea?
My code:
String keyStorePath = "/Users/cbenazza/Documents/workspace/passbook/src/main/resources/pem//Certificats_octo_test.p12";
String keyStorePassword = "test2";
PKSigningInformation pkSigningInformation = PKSigningUtil.loadSigningInformationFromPKCS12FileAndIntermediateCertificateFile(
keyStorePath, keyStorePassword, APPLE_WWDRCA);
My error when I code use Certificates.p12 in keyStorePath:
java.io.IOException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1277)
at java.security.KeyStore.load(KeyStore.java:1185)
at de.brendamour.jpasskit.signing.PKSigningUtil.loadPKCS12File(PKSigningUtil.java:200)
at de.brendamour.jpasskit.signing.PKSigningUtil.loadSigningInformationFromPKCS12FileAndIntermediateCertificateFile(PKSigningUtil.java:156)
at com.octo.passbook.PassSign.createPassAndSign(PassSign.java:34)
at com.octo.passbook.PassSignTest.createPassAndSignOK(PassSignTest.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.SunJCE_f.b(DashoA13_..)
at com.sun.crypto.provider.SunJCE_f.b(DashoA13_..)
at com.sun.crypto.provider.PKCS12PBECipherCore.b(DashoA13_..)
at com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndRC2_40.engineDoFinal(DashoA13_..)
at javax.crypto.Cipher.doFinal(DashoA13*..)
at com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:1274)
... 27 more
from jpasskit.
Strange, I didn't understand the error BadPaddingException. Indeed it was because my password was wrong.
thanx :)
from jpasskit.
:)
from jpasskit.
Related Issues (20)
- cannot open created .pkpass with valid certs HOT 3
- DepShield Deprecation Notice
- AppleWWDRCA.cer is expired, what certificate now? HOT 4
- Jackson needs to be updated to 2.15
- Missing release of jpasskit-parent on Maven Central HOT 3
- Using .p8 certificate HOT 4
- Dropping Java 8 support HOT 3
- Switch to gradle HOT 1
- FileNotFoundException in rest.ssl.keystore.path HOT 1
- I have a pkpass that doesn't open HOT 5
- `de.brendamour.jpasskit.signing.PKSigningUtil` is deprecated HOT 5
- Foreground color does not work if background image is set HOT 5
- How to add a QR code? HOT 1
- Create multiple passes at once HOT 2
- PKPassTemplateFolder - unable to load template path from .jar file HOT 1
- About PKPass and pass.json HOT 8
- Check if passes created already or not HOT 1
- Is it possible to set a message when using PKSendPushNotificationUtil.java HOT 2
- (Question) about sending push notification HOT 1
- known vulnerabilities in org.bouncycastle/[email protected] HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jpasskit.