ruby-on-rails – 用于AES-CBC-256的Rails OpenSSL :: Cipher使用什么样的填充?

填充块用于加密时,OpenSSL :: Cipher使用什么填充方案?文件含糊不清.

http://www.ruby-doc.org/stdlib-1.9.3/libdoc/openssl/rdoc/OpenSSL/Cipher.html#method-i-padding-3D

我需要使用不同语言的加密数据.我知道有很多类型的填充:

https://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Padding

最佳答案
你的第一个链接建议

See EVP_CIPHER_CTX_set_padding for further information.

This page表示(强调我的):

If padding is enabled (the default) then EVP_EncryptFinal_ex()
encrypts the “final” data, that is any data that remains in a
partial block. It uses standard block padding (aka PKCS padding). The
encrypted final data is written to out which should have sufficient
space for one cipher block. The number of bytes written is placed in
outl. After this function is called the encryption operation is
finished and no further calls to EVP_EncryptUpdate() should be made.

该页面还包含指向additional information that you may find helpful的链接.

转载注明原文:ruby-on-rails – 用于AES-CBC-256的Rails OpenSSL :: Cipher使用什么样的填充? - 代码日志