0

Is it possible to encrypt a .p7b file using a passphrase. ? I need to support the encrypted PKCS#7 files and then later use the java code to decrypt it.

1 Answers1

0

Yes, you can do it in three steps:

  1. Derive a key from your passphrase
  2. Encrypt data with key
  3. Package data into PKCS7/CMS format

Step 1 - Key Derivation

There are a few options for this. Some of the more common options are PBKDF2, Argon2, and BCrypt.

Steps 2 & 3 - Encryption & CMS Packaging

Since you tagged this with Java, I recommend using Bouncy Castle's CMSEncryptedDataGenerator class to construct the CMS object.

Hmmmmm
  • 778
  • 9
  • 20