Sure, there you go
Thanks!
The ecPublicKey
oid is misleading here; it doesn’t indicate that this is a public key, but rather than this key uses elliptic curve public key encryption. In short, that is a PKCS#8 private key.
Note For more background on this, see my On Cryptographic Key Formats post.
Given that, this statement in your original post is wrong:
Starting from a .p8
file which contains both a private and a public
key
Your .p8
contains just a private key.
I’m also concerned about this:
I'm looking for the required steps to create a certificate, then
create a JKS KeyStore, and finally import the certificate into the
KeyStore.
You shouldn’t need to create a certificate just to work with a private key.
And that brings me to this:
To authenticate on the Apple side, I use an Apex method called
Crypto.sign()
. The invalid_client
error message I'm getting from
Apple probably tells me that the JWT Salesforce sends is not signed
correctly.
You’re probably right about that (-:
But this:
As an alternative solution, I thought about using another Apex method
named Crypto.signWithCertificate()
, that says it all...
is taking you down the wrong path. Adding a certificate into this mix won’t help. Rather, you need to debug why signing with the key is failing.
What Apple service is this key for?
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"