Skip to content

Commit

Permalink
让加密程序报错方便调试
Browse files Browse the repository at this point in the history
  • Loading branch information
ziminghua committed Dec 23, 2016
1 parent e09f0e3 commit 8658d43
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions authentication/WXBizMsgCrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ def encrypt(self, text, appid):
text = pkcs7.encode(text)
# 加密
cryptor = AES.new(self.key, self.mode, self.key[:16])
try:
ciphertext = cryptor.encrypt(text)
# 使用BASE64对加密后的字符串进行编码
return ierror.WXBizMsgCrypt_OK, base64.b64encode(ciphertext)
except Exception, e:
#print e
return ierror.WXBizMsgCrypt_EncryptAES_Error, None
#try:
ciphertext = cryptor.encrypt(text)
# 使用BASE64对加密后的字符串进行编码
return ierror.WXBizMsgCrypt_OK, base64.b64encode(ciphertext)
#except Exception, e:
# print e
# return ierror.WXBizMsgCrypt_EncryptAES_Error, None

def decrypt(self, text, appid):
"""对解密后的明文进行补位删除
Expand Down
2 changes: 1 addition & 1 deletion wxapp/wxapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def weather_search(request):
if ret == 0:
return encrypt_xml
else:
return ret
return str(ret)

@staticmethod
def get_content(request):
Expand Down

0 comments on commit 8658d43

Please sign in to comment.