最近项目中遇到需要HTTPS Request,于是研究了一下AES256CBC模式的实现,鼓捣了两天始终不成功,代码不贴了,说一下情况吧
暂时要实现NodeJS端加密,IOS端解密
NodeJS端:
* key = 32个0
* iv = 16个0
* input-encoding = utf8
* output-encoding = base64
IOS端收到密文后解密,程序并不报错,状态返回kCCSuccess,可以打印出NSData,但是转换字符串为null,猜测是NSData数据不合规,尝试过替换结果中不合法的utf8字符,但是并不起作用
是不是我遗漏了什么关键步骤,还望各位指出,多谢
You need to debug this step by step according to the white paper. The white paper gives a clear ciphertext after encrypting the plaintext. If the ciphertext obtained after encryption on your node.js side is completely consistent with the result of the white paper, it means that the encryption side does not Any questions. Then debug the decryption side using the same principle. If there is no problem at both ends, joint debugging will be fine.
https uses public key encryption
You can check the character encoding method and see if the length of the decrypted plaintext is the same as the original md5