Search code examples
encryptionpaddingbouncycastle

Define Padding and IV in PKCS7 encryption with BouncyCastle


I'd like to make an encryption in PKCS#7 format using BouncyCastle, by using the org.bouncycastle.cms package. I need to define the padding and the initial value for encryption, but the classes of cms package don't allow to define this informations,how can i do that?


Solution

  • RFC 5652 Cryptographic Message Syntax (CMS), Section 14, page 54 states:

    Implementations must randomly generate content-encryption keys, message-authentication keys, initialization vectors (IVs), and padding.

    Thus, BouncyCastle implementation follows CMS standard.