@boone you can update and set values when only a public key is present. I think using attr_readonly would prevent that

On Dec 12, 2013, at 4:11 PM, Mike Boone <notifications@github.com> wrote:

> In spec/provider/postgres_pgp_public_key_spec.rb:
> 
> > +          specify { subject.encrypt(plain_text).should_not be_empty }
> > +        end
> > +
> > +        context "Integers" do
> > +          specify { subject.encrypt(integer_plain_text).should_not == integer_plain_text }
> > +          specify { subject.encrypt(integer_plain_text).should_not be_empty }
> > +        end
> > +      end
> > +
> > +      describe "#decrypt" do
> > +        specify { subject.decrypt(cipher_text).should == plain_text }
> > +        specify { subject.decrypt(integer_cipher_text).should == integer_plain_text.to_s }
> > +
> > +        it "does not decrypt w/o private key" do
> > +          pgp = PostgresPgpPublicKey.new key: ENCRYPTION_PASSWORD, public_key: public_key
> > +          pgp.decrypt(cipher_text).should be_nil
> @jmazzi true. But isn't the presence/absence of the private key at the app level? If the private key is not set when the app is started, all instances of a class which uses the encrypted column would be read only for that column. Maybe I'm picturing it incorrectly.
> 
> —
> Reply to this email directly or view it on GitHub.
>