Rails: storing encrypted data in database

后端 未结 5 931
后悔当初
后悔当初 2020-12-30 06:03

I want to encrypt database because confidential data is being stored. I use mongodb with mongoid. It possible for this kind of database? And what alternatives can you recome

5条回答
  •  不知归路
    2020-12-30 06:52

    Try the mongoid-encrypted-fields gem - it is seamless as it handles encryption using mongoize/demongoize methods.

    Just define your field like:

    field :ssn, type: Mongoid::EncryptedString
    

    Then you can access it like normal, but the data is stored encrypted.

提交回复
热议问题