Skip to content

msg encryption decipher

lanrion edited this page Dec 2, 2014 · 1 revision

多个公众号

rails generate weixin_rails_middleware:encrypt_migration public_account_model_name

新增 encoding_aes_key,app_id 两个字段,均为必填。

单个公众号

在 weixin_rails_middleware.rb中添加:

 config.encoding_aes_key = '<%= WeiXinUniqueToken.generate(generator: :hex, size: 22)[1..43] %>'
 config.app_id = "your app id"

兼容模式消息体同时存在明文和密文,此gem默认为密文。