jeudi 21 février 2019

How to convert mongodb data encrypted with Gibberish to RbNaCl

I took over a ROR/MongoDB project that is using Gibberish w/ Mongoid::EncryptedFields

Gibberish is outdated and not supported anymore. The entire database data is encrypted with Gibberish using something like the following.

Mongoid::EncryptedFields.cipher_same_salt = GibberishCipher1.new(ENV['MONGODB_SAME_SALT_KEY'], ENV['MONGODB_SALT'])

I am trying to switch to RbNaCl SimpleBox. My question is when I switch to RbNaCl if I try to pull a view it will need to decrypt the data to show the user. How can I get RbNaCl to decrypt the data that was encrypted with Gibberish? Gibberish encrypted it with Salt

@cipher.encrypt(text, salt: @salt)

Aucun commentaire:

Enregistrer un commentaire