【问题标题】:How do I create an encrypted PayPal button dynamically in Google App Engine?如何在 Google App Engine 中动态创建加密的 PayPal 按钮?
【发布时间】:2023-03-04 03:54:01
【问题描述】:

到目前为止,我已经为 Django 找到了一个使用 M2Cryptoexample,但是因为 M2Crypto 基于 C 库,所以它不能在 GAE 上运行。有没有人有在 Google App Engine 中动态创建加密 PayPal 按钮的工作代码?

简而言之,我需要将以下 Ruby 代码翻译成 Python。它取自 Ruby 的 PayPal's Website Payments Standard toolkit

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

【问题讨论】:

    标签: google-app-engine encryption paypal pkcs#7


    【解决方案1】:

    查看Keyczar 库,它应该可以在 Google App Engine 上运行,允许您使用 RSA 进行签名并使用 DES3 进行加密。

    查看文档here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-05
      • 1970-01-01
      • 1970-01-01
      • 2010-10-19
      • 2011-05-08
      • 2012-03-19
      • 2011-04-13
      • 2011-09-02
      相关资源
      最近更新 更多