到目前为止,我已经找到了使用example的Django M2Crypto,但由于M2Crypto基于C库,因此无法在GAE上运行。有没有人在Google App Engine中动态创建加密的PayPal按钮?
简而言之,我需要将以下Ruby代码翻译成Python。它取自PayPal's Website Payments Standard toolkit的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