如何在 Google App Engine 中动态创建加密的 PayPal 按钮?
到目前为止,我已经找到了一个使用M2Crypto,但由于M2Crypto基于C库,因此无法在GAE上运行。有人有在 Google App Engine 中动态创建加密 PayPal 按钮的工作代码吗?
简而言之,我需要将以下 Ruby 代码翻译为 Python。它取自 PayPal 网站付款标准用于 Ruby 的工具包。
def self.encrypt_data(paypal_cert, my_business_cert, my_business_key,
my_business_key_password, myparams )
paypal_cert = OpenSSL::X509::Certificate.new(paypal_cert)
my_business_cert = OpenSSL::X509::Certificate.new(my_business_cert)
my_business_key = OpenSSL::PKey::RSA.new(
my_business_key,
my_business_key_password)
info = ""
myparams.each_pair {|key,value| info << "#{key}=#{value}\n"}
signedInfo = OpenSSL::PKCS7::sign(
my_business_cert,
my_business_key,
info,
[],
OpenSSL::PKCS7::BINARY)
OpenSSL::PKCS7::encrypt(
[paypal_cert],
signedInfo.to_der,
OpenSSL::Cipher::Cipher::new("DES3"),
OpenSSL::PKCS7::BINARY)
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 Keyczar 库,它应该可以在 Google App Engine 上运行,允许您使用 RSA 进行签名 /em> 并使用 DES3 加密。
请在此处查看文档。
Have a look to Keyczar library, it should work on Google App Engine allowing you to sign using RSA and encrypt with DES3 .
Check the documentation here.