Builds the EncryptedData structure.
Promise resolving to the EncryptedData instance
Sets the encryption algorithm. Accepts either algorithm parameters or a pre-built algorithm identifier. If not set, defaults to PBES2 (PBKDF2 + AES-256-CBC).
The encryption algorithm parameters or identifier
This builder for chaining
Sets the content type using a friendly name.
The content type name
This builder for chaining
Sets the content type OID for the encrypted data.
This builder for chaining
Sets the data to encrypt.
The data bytes
This builder for chaining
Sets the iteration count for PBKDF2. Defaults to 2048.
The iteration count
This builder for chaining
Sets the IV for AES encryption. If not set, a random IV will be generated.
The IV bytes
This builder for chaining
Sets the password for encryption.
The password (string or bytes)
This builder for chaining
Sets the salt for PBKDF2. If not set, a random salt will be generated.
The salt bytes
This builder for chaining
Builder class for creating PKCS#7 EncryptedData structures.
Provides a fluent API for encrypting data. By default uses PBES2 (PBKDF2 + AES-256-CBC), but can accept custom algorithms via setAlgorithm().
Example