spikex / strongbox

Secures ActiveRecord attributes with public key encryption
http://stuff-things.net/2009/04/17/introducing-strongbox/
MIT License
398 stars 42 forks source link

if private key has no passphrase, the decrypted data can't be accessed #4

Closed rjharmon closed 14 years ago

rjharmon commented 14 years ago

It looks like you're asking if the passphrase is blank? instead of nil - if the secret key is not encrypted (being secured through other means), then the data can't be recovered with the current version of your code :)

Fortunately, it's an easy fix.

spikex commented 14 years ago

I've updated the code to support an unencrypted private key by setting the password to an empty string. Grab version 0.3.0.

I'm not sure I like using a blank password to imply an unencrypted key, so I may rework this in the future.

As part of this change I make it possible to also pass the keys as a string or a OpenSSL::PKey::RSA object, in addition to a file path.