ryantenney / passkit4j

Java library for generating Apple Passbook (.pkpass) files
http://www.ryantenney.com/passkit4j/
Apache License 2.0
80 stars 50 forks source link

I created the project using Ryan's PKPASS files, but I am finding one error in this field, I am attaching snapshot #27

Closed Kavit900 closed 9 years ago

Kavit900 commented 9 years ago

screenshot from 2015-07-21 13 16 25

ryantenney commented 9 years ago

Please check out Project Lombok and how install it for eclipse: https://projectlombok.org/download.html

Kavit900 commented 9 years ago

Thanks ryan that solved the problem, now I am stuck at this step, Please help me out.. 2

ryantenney commented 9 years ago

I'm afraid I can't help with generating PKCS12 keystores. Perhaps this might help? openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt

Kavit900 commented 9 years ago

Ryan Sir, I think the problem is coming when I call Keystore(Keystore,password) but there are two constructors and which one is getting called is giving the error. Just see once again at the error. 1

ryantenney commented 9 years ago

I'm sorry, you aren't providing me enough information to help you.

Kavit900 commented 9 years ago

Sir when I debuged the Program, I am getting stuck at this Part, And it says source not found at KeyStore keystore = KeyStore.getInstance(.....) , what could be reason, I think because I don't have correct bouncy jar files ??

static KeyStore loadPKCS12File(InputStream inputStream, String password) throws PassSigningException {
    ensureBCProvider();

    try {

        KeyStore keystore = KeyStore.getInstance("PKCS12", BouncyCastleProvider.PROVIDER_NAME);
        keystore.load(inputStream, chars(password));
        return keystore;

    } catch (Exception e) {
        throw propagateAsPassSigningException("Error loading PKCS12 KeyStore", e);
    } finally {
        try {
            if (inputStream != null) inputStream.close();
        } catch (IOException e) {}
    }
}
ryantenney commented 9 years ago

Clearly from the error you are receiving, the PKCS12 keystore file you are providing is invalid, thus "PKCS12 key store mac invalid". That is an error thrown by Bouncy Castle, not by Passkit4j.

Kavit900 commented 9 years ago

Ok so should I create another certificate on Apple store and then import it as .p12 and try it right Sir?

Kavit900 commented 9 years ago

Sir I when I am running this command - "openssl pkcs12 -in PassbookCert.p12 -clcerts -nokeys -out passcertificate.pem -passin pass:" then I get output - Mac verified OK then why it gives error when I provide path parameter to my java file for .p12 as Error loading PKCS12....

Sir for testing, do you have a Certificate.p12 file that you used for testing for EventExample.java and it worked, Can you upload it somewhere and paste the link here, I will try using that, I won't disturb you again Sir, Please Sir.

Thank You.

Kavit900 commented 9 years ago

Ryan Sir, I think I am near to the error, the KeyStorePassword that we pass to PassSigningUtil is the KeyStorePassword that we had given during creation of PassTypeID from Apple site or it is any password that we can give now while creating .pkpass. Please let me know, because I think I am giving wrong password that is causing the error.

kaanusha commented 7 years ago

Hello Kavit900,

I am also facing same issue. Have you cracked this exception, if so could you please help in solving this.

Kavit900 commented 7 years ago

Hi @kaanusha, I had fixed it but it was 2 years back, the issue was about using wrong password, I will try to look whether I have kept the code with me or not, if was for a company and I currently don't work there.