API-加密解密

不管是国标还是非国标,不管是对称还是非对称,直接拿来用


API说明

PYSunday内部使用的加解密

sunday.core.aesCbc.aesCbcDecrypt(data, passphrase)
sunday.core.aesCbc.aesCbcEncrypt(data, passphrase)

外部常见的加解密

基于cryptoJS

sunday.utils.cryptanalyst.cryptByCryptoJS(datastrList, key, cryptType='encrypt', mode='ECB')

cryptojs加解密 key: 公钥 cryptType: encrypt(加密)、decrypt(解密) mode: 加密方式

基于JSEncrypt

sunday.utils.cryptanalyst.cryptByJsEncrypt(datastrList, key, cryptType='encrypt', isHex=False)

jsencrypt加解密 key: 公钥 cryptType: encrypt(加密)、decrypt(解密)

国家标准密码

sunday.utils.cryptanalyst.cryptBySm4(datastrList, key, cryptType='encrypt')

国密4加解密 key: 公钥 cryptType: encrypt(加密)、decrypt(解密)

sunday.utils.cryptanalyst.cryptBySm2(datastrList, key, cryptType='encrypt')

国密2加解密 key: encrypt传公钥, decrypt传私钥 cryptType: encrypt(加密)、decrypt(解密)

可能会用到的方法

sunday.utils.cryptanalyst.grenKey(num1=None, num2=None)
sunday.utils.cryptanalyst.str2base16(oristr)