Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signature verification #3

Open
javadevmtl opened this issue Nov 11, 2014 · 3 comments
Open

Signature verification #3

javadevmtl opened this issue Nov 11, 2014 · 3 comments

Comments

@javadevmtl
Copy link

Any chance we will see the signature verification in the sample? :)

I tried...

    //Parse payment token here...

    System.out.println("Signature: " + signatureStr);
    System.out.println("Data: " + data);
    System.out.println("Transaction Id: " + transactionId);
    System.out.println("Ephemeral Key: " + ephemeralKey);
    System.out.println("Concat: " + concat);


    Signature sig = Signature.getInstance("SHA256withECDSA", "BC");
    sig.initSign(merchantPrivateKey);
    sig.update(concat.getBytes());
    byte[] signature = sig.sign();
    System.out.println(Base64.encodeBase64String(signature));

But it doesn't seem to match...

@javadevmtl
Copy link
Author

Wish the docs where a bit clearer here: https://developer.apple.com/library/ios/documentation/PassKit/Reference/PaymentTokenJSON/PaymentTokenJSON.html#//apple_ref/doc/uid/TP40014929

But basically you need to parse the "siganture" as pkcs#7 which includes a bunch of certificates plus the actual signature.

You can base64 decode the signature and write the bytes to a file then use openssl (openssl pkcs7 -text -in yourfile.txt -inform DER -print_certs)to view it.

But Any APi that can parse pkcs7 will do the trick too.

This should help thing get rolling along a bit easier.

@Cris464
Copy link

Cris464 commented Jan 8, 2015

can you Please provide the code for Signature verification

@zooz-mobile
Copy link

Apple-Pay-Signature-Verification:
https://github.com/zooz-mobile/Apple-Pay-Signature-Verification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants