I am using this library from apple to verify a transaction made with Apple in-app purchase:
https://github.com/apple/app-store-server-library-java
I have a valid signed transaction, when I use the SignedDataVerifier, it throws
SignatureVerificationException: The Token's Signature resulted invalid when verified using the Algorithm: SHA256withECDSA
Here is my code:
fun verifyCertificate() {
val bundleId = "my bundle id"
val environment = Environment.SANDBOX
val rootCAs = mutableSetOf(
computerCert.inputStream,
incCert.inputStream,
g2cert.inputStream,
g3cert.inputStream
)
val signedDataVerifier = SignedDataVerifier(rootCAs, bundleId, null, environment, false)
val signedTransaction = "eyJhbGci..."
try {
val transaction = signedDataVerifier .verifyAndDecodeTransaction(signedTransaction )
println(transaction)
} catch (e: VerificationException) {
e.printStackTrace()
}
}




