gpt4 book ai didi

ios - Apple Pay - 解密支付数据

转载 作者:可可西里 更新时间:2023-11-01 17:16:43 24 4
gpt4 key购买 nike

我正在尝试在成功的 Apple Pay 授权后解密 PKPaymentToken 对象的 paymentData 属性。

我正在尝试按照说明进行操作 here ,但我停留在解密步骤的第 2 步,上面写着:

Use the value of the publicKeyHash key to determine which merchant public key was used by Apple, and then retrieve the corresponding merchant public key certificate and private key.

我该怎么做?

请指教。

谢谢!

最佳答案

根据从 Apple Developer Center 下载的 Apple Pay 证书文件,以下是如何使用 Ruby 计算 publicKeyHash。

require "base64"
require "digest"
require "openssl"

# set cert_file = path to the downloaded Apple Pay .cer file

cert = OpenSSL::X509::Certificate.new(File.read(cert_file))
# strip off the "-----BEGIN PUBLIC KEY-----" line at the start of the string
pem = cert.public_key.to_pem.split("\n").drop(1)
# strip off the "-----END PUBLIC KEY-----" line at the end of the string
pem = pem.take(pem.length - 1)

decoded = Base64.decode64(pem.join)
public_key_hash = Digest::SHA256.base64digest(decoded)

关于ios - Apple Pay - 解密支付数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27473085/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com