swh.web.auth.utils module

swh.web.auth.utils.encrypt_data(data: bytes, password: bytes, salt: bytes) bytes[source]

Encrypt data using Fernet system (symmetric encryption).

Parameters
  • data – input data to encrypt

  • password – user password that will be used to generate a Fernet key derivation function

  • salt – value that will be used to generate a Fernet key derivation function

Returns

The encrypted data

swh.web.auth.utils.decrypt_data(data: bytes, password: bytes, salt: bytes) bytes[source]

Decrypt data using Fernet system (symmetric encryption).

Parameters
  • data – input data to decrypt

  • password – user password that will be used to generate a Fernet key derivation function

  • salt – value that will be used to generate a Fernet key derivation function

Returns

The decrypted data