AES/ECB/pkcs5padding
C ++ does not seem to have such a standard, so if the program needs this format, you need to manually implement it.
In fact, there are a lot of resources in AES/ECB and C ++ on the Internet, that is, pkcs5padding. This can be achieved quite a little. The implementation principle is as follows:
AES is usually composed of 16 bytes and then encrypted. If the input string does not have 16 bytes, it must be supplemented,
Pkcs5padding: The filling principle is that if the length is less than 16 bytes, you need to fill up 16 bytes, fill (16-len) (16-len) for example:
The huguozhen character string is 9 bytes, 16-9 = 7. After it is filled up, for example, huguozhen + 7 decimal 7
If the string length is exactly 16 bytes, you need to add 16 bytes in decimal format.
The above is about encryption. For decryption, the strings to be decrypted are determined by byte. The specific principles are as follows:
Because the encryption is completed in decimal 1 to 16, during decryption, you need to remove this part of the complement to determine the string to be decrypted, whether each byte is Char> = 1 & char <= 16. If yes, use 0 to replace the previous value until the end.
Note that the C ++ string ends with a space.
Ayilian: After encryption, the first character is 0, that is, the subsequent string cannot be read. Therefore, in enbase64, you must specify the length and string pointer, do not just pass in the string pointer, so the encrypted value is null.
Hope to help you, if you have any questions, please contact me, guyuewuhua@163.com