devise_aes_encryptable 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/README.rdoc +15 -0
- data/VERSION +1 -1
- data/devise_aes_encryptable.gemspec +5 -5
- data/lib/encryptors/aes256.rb +12 -12
- metadata +8 -8
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -2,6 +2,21 @@
|
|
2
2
|
|
3
3
|
Adds AES encryption support for Devise
|
4
4
|
|
5
|
+
= Synopsis
|
6
|
+
|
7
|
+
== Installation
|
8
|
+
1. Add <tt>devise_aes_encryptable</tt> to your Gemfile
|
9
|
+
2. <tt>bundle install</tt>
|
10
|
+
|
11
|
+
== Configuration
|
12
|
+
In <tt>config/initializers/devise.rb</tt>
|
13
|
+
config.encryptor = :aes256
|
14
|
+
|
15
|
+
== Decryption
|
16
|
+
::AES.decrypt(encrypted_password, Devise.pepper)
|
17
|
+
or
|
18
|
+
::Devise::Encryptors::Aes256.decrypt(encrypted_password, Devise.pepper)
|
19
|
+
|
5
20
|
== Contributing to devise_aes_encryptable
|
6
21
|
|
7
22
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{devise_aes_encryptable}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Carl Hicks"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-01-03}
|
13
13
|
s.description = %q{Adds Devise::Encryptors::Aes256.digest and Devise::Encryptors::Aes256.decrypt}
|
14
14
|
s.email = %q{carl.hicks@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -44,7 +44,7 @@ Gem::Specification.new do |s|
|
|
44
44
|
s.specification_version = 3
|
45
45
|
|
46
46
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
|
-
s.add_runtime_dependency(%q<aes>, [">= 0.
|
47
|
+
s.add_runtime_dependency(%q<aes>, [">= 0.4.0"])
|
48
48
|
s.add_runtime_dependency(%q<devise>, [">= 1.1.3"])
|
49
49
|
s.add_runtime_dependency(%q<rails>, ["~> 3.0.0"])
|
50
50
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
@@ -52,7 +52,7 @@ Gem::Specification.new do |s|
|
|
52
52
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
53
53
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
54
54
|
else
|
55
|
-
s.add_dependency(%q<aes>, [">= 0.
|
55
|
+
s.add_dependency(%q<aes>, [">= 0.4.0"])
|
56
56
|
s.add_dependency(%q<devise>, [">= 1.1.3"])
|
57
57
|
s.add_dependency(%q<rails>, ["~> 3.0.0"])
|
58
58
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
@@ -61,7 +61,7 @@ Gem::Specification.new do |s|
|
|
61
61
|
s.add_dependency(%q<rcov>, [">= 0"])
|
62
62
|
end
|
63
63
|
else
|
64
|
-
s.add_dependency(%q<aes>, [">= 0.
|
64
|
+
s.add_dependency(%q<aes>, [">= 0.4.0"])
|
65
65
|
s.add_dependency(%q<devise>, [">= 1.1.3"])
|
66
66
|
s.add_dependency(%q<rails>, ["~> 3.0.0"])
|
67
67
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
data/lib/encryptors/aes256.rb
CHANGED
@@ -5,20 +5,20 @@ module Devise
|
|
5
5
|
# = AES
|
6
6
|
# Uses the AES algorithm to encrypt passwords.
|
7
7
|
class Aes256 < Base
|
8
|
-
# Returns a Base64 encrypted password where pepper is used for the key,
|
9
|
-
# and the initialization_vector is randomly generated and prepended onto
|
10
|
-
# encoded ciphertext
|
11
|
-
def self.digest(password, stretches, salt, pepper)
|
12
|
-
digest = ::AES.encrypt(pepper, password)
|
13
|
-
end
|
14
8
|
class << self
|
9
|
+
# Returns a Base64 encrypted password where pepper is used for the key,
|
10
|
+
# and the initialization_vector is randomly generated and prepended onto
|
11
|
+
# encoded ciphertext
|
12
|
+
def digest(password, stretches, salt, pepper)
|
13
|
+
digest = ::AES.encrypt(password, pepper, {:iv => salt})
|
14
|
+
end
|
15
15
|
alias :encrypt :digest
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
|
17
|
+
# Returns the plaintext password where pepper is used for the key,
|
18
|
+
# and the initialization_vector is read from the Base64 encoded ciphertext
|
19
|
+
def decrypt(encrypted_password, pepper)
|
20
|
+
password = ::AES.decrypt(encrypted_password, pepper)
|
21
|
+
end
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_aes_encryptable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Carl Hicks
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-03 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -27,12 +27,12 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
30
|
+
hash: 15
|
31
31
|
segments:
|
32
32
|
- 0
|
33
|
-
-
|
33
|
+
- 4
|
34
34
|
- 0
|
35
|
-
version: 0.
|
35
|
+
version: 0.4.0
|
36
36
|
requirement: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
type: :runtime
|