请教:openresty能否集成RES或RSA的加密解密模块?

564 views
Skip to first unread message

steven

unread,
May 13, 2012, 11:20:26 PM5/13/12
to openresty
我的应用场景:

手机客户端与服务器之间采用https协议进行通信,并对传输的内容进行RSA和DES的加密.
我想通过lua或nginx的模块对手机客户端传过来的消息进行RSA或DES解密.
但是不清楚现在是否有这样的模块?

或者请教一下各位同学,对客户端和服务器之间的消息加密解密是否有更好的建议?

wd

unread,
May 14, 2012, 2:41:59 AM5/14/12
to open...@googlegroups.com
自己写个 c 的 so 通过调用 openssl 的库加解密
在 lua 里面调用 so 里面的东西

2012/5/14 steven <suyi...@gmail.com>:
> 我的应用场景:
>
> 手机客户端与服务器之间采用https协议进行通信,并对传输的内容进行RSA和DES的加密.
> 我想通过lua或nginx的模块对手机客户端传过来的消息进行RSA或DES解密.
> 但是不清楚现在是否有这样的模块?
>
> 或者请教一下各位同学,对客户端和服务器之间的消息加密解密是否有更好的建议?
>
> --
> 邮件自: 列表“openresty”,专用于技术讨论!
> 发言: 请发邮件到 open...@googlegroups.com
> 退订: 请发邮件至 openresty+...@googlegroups.com
> 详情: http://groups.google.com/group/openresty
> 官网: http://openresty.org/
> 仓库: https://github.com/agentzh/ngx_openresty
> 建议: 提问的智慧 http://wiki.woodpecker.org.cn/moin/AskForHelp
> 教程: http://agentzh.org/misc/nginx/agentzh-nginx-tutorials-zhcn.html

agentzh

unread,
May 14, 2012, 3:13:00 AM5/14/12
to open...@googlegroups.com
2012/5/14 steven <suyi...@gmail.com>:
> 我想通过lua或nginx的模块对手机客户端传过来的消息进行RSA或DES解密.
> 但是不清楚现在是否有这样的模块?
>

lua-resty-string 库的 0.06 版刚刚包含了 resty.aes 模块,通过 LuaJIT FFI 向 Lua 提供了
OpenSSL 的 AES API:

https://github.com/agentzh/lua-resty-string

可以仿照着 resty.aes 模块再写一个 resty.des 和 resty.rsa 模块 :)

通过 LuaJIT FFI 方式暴露的 C API 要比通过标准 Lua C 模块的方式更为高效,因为 LuaJIT 有机会直接在 JIT
生成的机器码中直接内联相关的 C 库调用。

目前的 ngx_openresty 稳定版和开发版都尚未包含 lua-resty-string 0.06,但下面这个 1.0.15.5rc2
中已经包含了它(以及这两天的一些新 bug 修复):

http://agentzh.org/misc/nginx/ngx_openresty-1.0.15.5rc2.tar.gz

Best regards,
-agentzh

steven

unread,
May 15, 2012, 4:44:52 AM5/15/12
to openresty
谢谢春哥回复
我在你的博客上看了nginx的部分教程,如果有时间的话,希望你继续往下写或者整理出书啊.
非常期待.

On 5月14日, 下午3时13分, agentzh <agen...@gmail.com> wrote:
> 2012/5/14 steven <suyis...@gmail.com>:

agentzh

unread,
May 15, 2012, 5:17:02 AM5/15/12
to open...@googlegroups.com
2012/5/15 steven <suyi...@gmail.com>:
> 谢谢春哥回复
> 我在你的博客上看了nginx的部分教程,如果有时间的话,希望你继续往下写或者整理出书啊.
> 非常期待.
>

呵呵,我会继续写教程的,只是眼下我被用户补丁和邮件淹没了。。。呵呵

Regards,
-agentzh

Reply all
Reply to author
Forward
0 new messages