Google App Engine Python的RSA加密例程 [英] RSA encryption routines for Google App Engine Python

查看:127
本文介绍了Google App Engine Python的RSA加密例程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我试图在python中生成一个签名的url。基本上,我试图从Google App Engine服务器访问受保护的Amazon Cloudfront内容。亚马逊为我提供了一个pem文件,其内容如下所示:



----- BEGIN RSA PRIVATE KEY -----



MIICWQf ....更多字符... 7bx8WiUk



-----完RSA PRIVATE KEY ---- -



根据使用Python进行安全的AWS CloudFront流式传输入门,通过EVP生成签名url,例如: key = EVP.load_key_string(priv_key_string)。主要问题是Google App Engine不支持M2Crypto导入EVP 中的。我试过Google搜寻 RSA加密例程Google App Engine ,但还没有找到任何可行的模块。一个我偶然发现,签名一个在Google App Engine Python SDK上使用RSA私钥的字符串,表示我可以使用tlslite.utils import keyfactory 中的。然而,我仍然得到了一个响应:没有名为tlslite.utils的模块



总之,我只是想知道是否有人知道是否在Google App Engine上执行RSA加密例程的模块。感谢您的帮助,我们一如既往地感激不尽。正如bossylobster指出的那样,您可以做的是包含RSA包需要将程序包的源代码作为应用程序目录结构中的子目录复制,作为应用程序的一部分。这会作为您应用的另一部分上传到应用引擎服务。只要包仅使用应用引擎在生产中提供的那些标准库模块,它将按预期运行。目录结构最终看起来像这样:

  mysite / 
app.yaml
main.py
urls.py
...
tlslite /
__init__.py
...


Hey, I'm trying to generate a signed url in python. Basically, I'm trying to access protected Amazon Cloudfront content from a Google App Engine server. Amazon has provided me with a pem file that has content which looks like:

-----BEGIN RSA PRIVATE KEY-----

MIICWQf....a lot more characters...7bx8WiUk

-----END RSA PRIVATE KEY-----

According to Getting started with secure AWS CloudFront streaming with Python, a signed url is generated through EVP as such: key = EVP.load_key_string(priv_key_string). The main problem is that Google App Engine does not support from M2Crypto import EVP. I've tried googling RSA encryption routines Google App Engine but have not found any modules that work. One I stumbled across, Signing a string with RSA private key on Google App Engine Python SDK, said I could use from tlslite.utils import keyfactory. Yet I still get a response that says No module named tlslite.utils.

In summary, I'm just wondering if anyone know's if a module that does RSA encryption routines on Google App Engine. Thanks, your help is greatly appreciated as always

解决方案

As bossylobster pointed out, what you can do is include the RSA package that you need as a part of your application by copying the package's source code as a sub-directory within your app's directory structure. This gets uploaded to the app-engine service as just another part of your app. As long as the package only uses those standard library modules that app-engine provides in production, it will run as expected. The directory structure would end up looking something like:

mysite/
    app.yaml
    main.py
    urls.py
    ...
    tlslite/
        __init__.py
        ...

这篇关于Google App Engine Python的RSA加密例程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆