acts_as_encrypted 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Manifest.txt +0 -1
- data/lib/acts_as_encrypted.rb +15 -7
- metadata +4 -5
- data/bin/acts_as_encrypted +0 -4
data/Manifest.txt
CHANGED
data/lib/acts_as_encrypted.rb
CHANGED
@@ -2,9 +2,17 @@ require 'openssl'
|
|
2
2
|
require 'ostruct'
|
3
3
|
# ActsAsEncrypted
|
4
4
|
module ActsAsEncrypted
|
5
|
-
VERSION = '1.0.
|
6
|
-
|
7
|
-
|
5
|
+
VERSION = '1.0.1'
|
6
|
+
class ActsConfig
|
7
|
+
def initialize
|
8
|
+
@dbCipherType='aes-256-cbc'
|
9
|
+
@dbCipherKey='965f79fc27052324879b138b46df31e6f66c4d00'
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_reader :dbCipherType, :dbCipherKey
|
13
|
+
attr_writer :dbCipherType, :dbCipherKey
|
14
|
+
end
|
15
|
+
Config = ActsConfig.new
|
8
16
|
module Acts
|
9
17
|
module Encrypted
|
10
18
|
# included is called from the ActiveRecord::Base
|
@@ -117,8 +125,8 @@ class EncryptionWrapper
|
|
117
125
|
|
118
126
|
def encrypt(value)
|
119
127
|
unless value.nil?
|
120
|
-
c = OpenSSL::Cipher.new(ActsAsEncrypted::
|
121
|
-
c.pkcs5_keyivgen ActsAsEncrypted::
|
128
|
+
c = OpenSSL::Cipher.new(ActsAsEncrypted::Config.dbCipherType).encrypt
|
129
|
+
c.pkcs5_keyivgen ActsAsEncrypted::Config.dbCipherKey
|
122
130
|
c.update value
|
123
131
|
return ActiveSupport::Base64.encode64(c.final)
|
124
132
|
else
|
@@ -128,8 +136,8 @@ class EncryptionWrapper
|
|
128
136
|
|
129
137
|
def decrypt(value)
|
130
138
|
unless value.nil?
|
131
|
-
c = OpenSSL::Cipher.new(ActsAsEncrypted::
|
132
|
-
c.pkcs5_keyivgen ActsAsEncrypted::
|
139
|
+
c = OpenSSL::Cipher.new(ActsAsEncrypted::Config.dbCipherType).decrypt
|
140
|
+
c.pkcs5_keyivgen ActsAsEncrypted::Config.dbCipherKey
|
133
141
|
c.update(ActiveSupport::Base64.decode64(value))
|
134
142
|
return c.final
|
135
143
|
else
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_encrypted
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Bartlow
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-07-
|
12
|
+
date: 2008-07-30 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -25,8 +25,8 @@ dependencies:
|
|
25
25
|
description: A quick and easy encryption wrapper. using the built in openssl functions. Usable in String, Text, or Binary fields. (Encodes in Base 64 before saving)
|
26
26
|
email:
|
27
27
|
- bartlow.3@osu.edu
|
28
|
-
executables:
|
29
|
-
|
28
|
+
executables: []
|
29
|
+
|
30
30
|
extensions: []
|
31
31
|
|
32
32
|
extra_rdoc_files:
|
@@ -42,7 +42,6 @@ files:
|
|
42
42
|
- rails/install.rb
|
43
43
|
- lib/acts_as_encrypted.rb
|
44
44
|
- uninstall.rb
|
45
|
-
- bin/acts_as_encrypted
|
46
45
|
has_rdoc: true
|
47
46
|
homepage: actsasencrypted.rubyforge.org
|
48
47
|
post_install_message:
|
data/bin/acts_as_encrypted
DELETED