|
2 | 2 |
|
3 | 3 | module Authlogic
|
4 | 4 | module CryptoProviders
|
5 |
| - # This encryption method is reversible if you have the supplied key. So in order to |
6 |
| - # use this encryption method you must supply it with a key first. In an initializer, |
7 |
| - # or before your application initializes, you should do the following: |
| 5 | + # This encryption method is reversible if you have the supplied key. So in |
| 6 | + # order to use this encryption method you must supply it with a key first. |
| 7 | + # In an initializer, or before your application initializes, you should do |
| 8 | + # the following: |
8 | 9 | #
|
9 | 10 | # Authlogic::CryptoProviders::AES256.key = "long, unique, and random key"
|
10 | 11 | #
|
11 |
| - # My final comment is that this is a strong encryption method, but its main weakness |
12 |
| - # is that it's reversible. If you do not need to reverse the hash then you should |
13 |
| - # consider Sha512 or BCrypt instead. |
| 12 | + # My final comment is that this is a strong encryption method, but its main |
| 13 | + # weakness is that it's reversible. If you do not need to reverse the hash |
| 14 | + # then you should consider Sha512 or BCrypt instead. |
14 | 15 | #
|
15 |
| - # Keep your key in a safe place, some even say the key should be stored on a separate |
16 |
| - # server. This won't hurt performance because the only time it will try and access the |
17 |
| - # key on the separate server is during initialization, which only happens once. The |
18 |
| - # reasoning behind this is if someone does compromise your server they won't have the |
19 |
| - # key also. Basically, you don't want to store the key with the lock. |
| 16 | + # Keep your key in a safe place, some even say the key should be stored on a |
| 17 | + # separate server. This won't hurt performance because the only time it will |
| 18 | + # try and access the key on the separate server is during initialization, |
| 19 | + # which only happens once. The reasoning behind this is if someone does |
| 20 | + # compromise your server they won't have the key also. Basically, you don't |
| 21 | + # want to store the key with the lock. |
20 | 22 | class AES256
|
21 | 23 | class << self
|
22 | 24 | attr_writer :key
|
@@ -53,6 +55,9 @@ def aes
|
53 | 55 | # (https://github.com/ruby/openssl/commit/5c20a4c014) when openssl
|
54 | 56 | # became a gem. Its first release as a gem was 2.0.0, in ruby 2.4.
|
55 | 57 | # (See https://github.com/ruby/ruby/blob/v2_4_0/NEWS)
|
| 58 | + # |
| 59 | + # When we eventually drop support for ruby < 2.4, we can probably also |
| 60 | + # drop support for openssl gem < 2. |
56 | 61 | def openssl_cipher_class
|
57 | 62 | if ::Gem::Version.new(::OpenSSL::VERSION) < ::Gem::Version.new("2.0.0")
|
58 | 63 | ::OpenSSL::Cipher::Cipher
|
|
0 commit comments