How to create an encrypted PayPal button dynamically in Google App Engine?

So far I have found an example for Django that uses M2Crypto , but since M2Crypto is based on the C library, it cannot be run on GAE. Does anyone have working code to create an encrypted PayPal button dynamically in the Google App Engine?

In short, I need to translate the following Ruby code into Python. It is taken from the PayPal Standardization Website Toolkit for 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
+3
source share
1 answer

Keyczar, Google App Engine, RSA DES3.

.

0

Source: https://habr.com/ru/post/1734416/


All Articles