use*_*123 3 encryption ios ios8.1 applepay
我试图在Apple Pay授权成功后解密对象的paymentData属性PKPaymentToken.
我试图按照这里的说明进行操作,但我仍然坚持解密步骤的第2步,其中说:
使用publicKeyHash密钥的值来确定Apple使用了哪个商家公钥,然后检索相应的商家公钥证书和私钥.
我怎么做?
请指教.
谢谢!
小智 5
以下是在Apple开发人员中心下载的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)
Run Code Online (Sandbox Code Playgroud)