README.md in crypt_keeper-0.17.0 vs README.md in crypt_keeper-0.18.0
- old
+ new
@@ -45,9 +45,38 @@
That means using `update_column` will not perform any encryption. This is
expected behavior, and has its use cases. An example would be migrating from
one type of encryption to another. Using `update_column` would allow you to
update the content without going through the current encryptor.
+## Encodings
+
+You can force an encoding on the plaintext before encryption and after decryption by using the `encoding` option. This is useful when dealing with multibyte strings:
+
+```ruby
+class MyModel < ActiveRecord::Base
+ crypt_keeper :field, :other_field, :encryptor => :aes_new, :key => 'super_good_password', salt: 'salt', :encoding => 'UTF-8'
+end
+
+model = MyModel.new(field: 'Tromsø')
+model.save! #=> Your data is now encrypted
+model.field #=> 'Tromsø'
+model.field.encoding #=> #<Encoding:UTF-8>
+```
+
+## Adding encryption to an existing table
+
+If you are working with an existing table you would like to encrypt, you must use the `MyExistingModel.encrypt_table!` class method.
+
+```ruby
+class MyExistingModel < ActiveRecord::Base
+ crypt_keeper :field, :other_field, :encryptor => :aes_new, :key => 'super_good_password', salt: 'salt'
+end
+
+MyExistingModel.encrypt_table!
+```
+
+Running `encrypt_table!` will encrypt all rows in the database using the encryption method specificed by the `crypt_keeper` line in your model.
+
## Supported Available Encryptors
There are four supported encryptors: `aes_new`, `mysql_aes_new`, `postgresql_pgp`, `postgres_pgp_public_key`.
* [AES New](https://github.com/jmazzi/crypt_keeper/blob/master/lib/crypt_keeper/provider/aes_new.rb)