Recently, the project encountered the need for HTTPS Request, so I studied the implementation of AES256CBC mode. after two days of hard work, it was not successful. the code was not posted. let’s talk about the situation.
For the time being, NodeJS encryption and IOS decryption will be implemented.
* key = 32 zeros * iv = 16 zeros * input-encoding = utf8 * output-encoding = base64
After receiving the ciphertext, IOS side decrypts it. the program does not report an error. the state returns kCCSuccess, and NSData can be printed out. however, the conversion string is null. it is assumed that NSData data is out of compliance. it has tried to replace the illegal utf8 character in the result, but it has no effect.
Did I miss any key steps? I hope you can point out, thank you very much.
You need to debug this step by step according to the white paper. The white paper inside gives a clear ciphertext after plaintext encryption. If the ciphertext obtained after encryption by your node.js end is completely consistent with the result of the white paper, then there is no problem at the encryption end. Then debug the decryption end with the same principle. If there is no problem at both ends, it will be better to adjust it in combination.