does ruby-aes use padding by default?

感情迁移 提交于 2019-12-04 20:40:16

Aes.encrypt_buffer will use padding, just not that kind that you are expecting. It will pad the block with n bytes with the value of added bytes. That is to say, if it needs to add 15 bytes, it will pad with 0x0f, if it needs to add 5bytes, it will pad with 0x05. That is to say, PKCS7 as described in RFC-5652.

You should switch to openssl or use Cipher.getInstance("AES/ECB/PKCS7Padding", "BC") with java.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!