fernet_passphrase v1.1.0 Fernet.Passphrase View Source

This module provides function to encrypt and decrypt a string using a passphrase. The implementation is designed to work cross-language; currently there are packages for the browser (using the WebCrypto API), NodeJS and PHP.

Details

The passphrase is converted to a key using PBKDF2 with a random salt, and then this is used as a key for Fernet encryption.

Link to this section Summary

Functions

Decrypt the given ciphertext with the given passphrase

Encrypt the given text with the given passphrase

Generate a key from the given passphrase. Since generating a key is costly, this function is exposed separately from encrypt

Link to this section Functions

Link to this function

decrypt(passphrase, ciphertext) View Source

Decrypt the given ciphertext with the given passphrase.

Link to this function

encrypt(passphrase, plaintext, options \\ []) View Source

Encrypt the given text with the given passphrase.

Options

  • iterations: The number of iterations to use during PBKDF2 key derivation (default 10000).
Link to this function

generate_key(passphrase, options \\ []) View Source

Generate a key from the given passphrase. Since generating a key is costly, this function is exposed separately from encrypt

Options

  • iterations: The number of iterations to use during PBKDF2 key derivation (default 10000).