attr-encrypted / attr_encrypted

Generates attr_accessors that encrypt and decrypt attributes
MIT License
2.01k stars 426 forks source link

Decrypting outside of attr_encrypted (postgresql) #135

Closed jonuhal closed 9 years ago

jonuhal commented 9 years ago

I have a few fields pushed into PostgreSQL through attr_encrypted. The data looks like "L58SJMjWkqotLjyCfOY+LQ==+" when it's in the database. I have a Jasper report server that is trying to query the data and display it in a report, but without going through the Rails application (direct Jasper to the db). I am wondering if there is a way to decrypt the fields encrypted using the attr_encrypted functionality outside of the Rails application. I am assuming that pgcrypto can do it, but I'm not sure about this since I've never used pgcrypto before. Do you know if this is possible?

saghaulor commented 9 years ago

@jonuhal As long as your external application (postgres in this case) have access to the salt, IV, cipher text and the correct encryption key, assuming that they can perform crypto operations using the correct algorithm, you can decrypt outside of Rails.