Skip to content

Latest commit

 

History

History
27 lines (17 loc) · 876 Bytes

README.md

File metadata and controls

27 lines (17 loc) · 876 Bytes

Rails ActiveRecord encryption for python

Rails 7 introduced a new option in ActiveRecord to encrypt data.

This library aims at decrypting the data with a simple interface.

Usage

  1. Find your credentials primary_key and key_derivation_salt (those generated by Rails bin/rails db:encryption:init - see RoR docs linked below)
  2. Add the package pip install git+ssh://[email protected]/digitalepidemiologylab/rails_ar_encryption.git
  3. Use it
from rails_ar_encryption import derive_key, decrypt

# step 1 - derive the encryption key
key = derive_key(primary_key, key_derivation_salt)

# step 2 - decrypt message (message is the full payload generated by Rails)
clear_text = decrypt(message, key)

Have a look at a working example.

Notes