loyal3-sentry 0.4.2 → 0.4.3
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/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/active_record/sentry.rb +7 -2
- data/lib/sentry.rb +1 -1
- data/sentry.gemspec +5 -4
- data/test/asymmetric_sentry_callback_test.rb +4 -0
- metadata +4 -4
data/Rakefile
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.4.
|
|
1
|
+
0.4.3
|
data/lib/active_record/sentry.rb
CHANGED
|
@@ -46,8 +46,7 @@ module ActiveRecord # :nodoc:
|
|
|
46
46
|
alias_method "#{attr_name}_before_type_cast", "#{attr_name}_with_decryption"
|
|
47
47
|
|
|
48
48
|
define_method("#{attr_name}_with_encryption=") do |value|
|
|
49
|
-
|
|
50
|
-
encrypted_value = ::Sentry::AsymmetricSentry.encrypt_to_base64(padded_value)
|
|
49
|
+
encrypted_value = self.class.encrypt_for_sentry(value)
|
|
51
50
|
self.send("#{attr_name}_without_encryption=", encrypted_value)
|
|
52
51
|
nil
|
|
53
52
|
end
|
|
@@ -56,6 +55,12 @@ module ActiveRecord # :nodoc:
|
|
|
56
55
|
end
|
|
57
56
|
|
|
58
57
|
end
|
|
58
|
+
|
|
59
|
+
def encrypt_for_sentry(string)
|
|
60
|
+
padded_value = ActiveRecord::Sentry.rand_string + string
|
|
61
|
+
encrypted_value = ::Sentry::AsymmetricSentry.encrypt_to_base64(padded_value)
|
|
62
|
+
end
|
|
63
|
+
|
|
59
64
|
private
|
|
60
65
|
|
|
61
66
|
#def symmetrically_encrypts(attr_name)
|
data/lib/sentry.rb
CHANGED
data/sentry.gemspec
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = %q{sentry}
|
|
5
|
-
s.version = "0.4.
|
|
5
|
+
s.version = "0.4.3"
|
|
6
6
|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["John Pelly", "David Stevenson"]
|
|
9
|
-
s.date = %q{2009-
|
|
9
|
+
s.date = %q{2009-08-04}
|
|
10
10
|
s.description = %q{Asymmetric encryption of active record fields}
|
|
11
11
|
s.email = %q{commoncode@pivotallabs.com}
|
|
12
12
|
s.extra_rdoc_files = [
|
|
@@ -46,10 +46,11 @@ Gem::Specification.new do |s|
|
|
|
46
46
|
"test/symmetric_sentry_test.rb",
|
|
47
47
|
"test/tests.rb"
|
|
48
48
|
]
|
|
49
|
+
s.has_rdoc = true
|
|
49
50
|
s.homepage = %q{http://github.com/pivotal/sentry}
|
|
50
51
|
s.rdoc_options = ["--charset=UTF-8"]
|
|
51
52
|
s.require_paths = ["lib"]
|
|
52
|
-
s.rubygems_version = %q{1.3.
|
|
53
|
+
s.rubygems_version = %q{1.3.1}
|
|
53
54
|
s.summary = %q{Asymmetric encryption of active record fields}
|
|
54
55
|
s.test_files = [
|
|
55
56
|
"test/abstract_unit.rb",
|
|
@@ -65,7 +66,7 @@ Gem::Specification.new do |s|
|
|
|
65
66
|
|
|
66
67
|
if s.respond_to? :specification_version then
|
|
67
68
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
68
|
-
s.specification_version =
|
|
69
|
+
s.specification_version = 2
|
|
69
70
|
|
|
70
71
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
|
71
72
|
else
|
|
@@ -33,6 +33,10 @@ class AsymmetricSentryCallbackTest < ActiveSupport::TestCase
|
|
|
33
33
|
assert_equal @orig, users(:user_2).creditcard
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
def test_encrypt_for_sentry
|
|
37
|
+
assert_not_nil User.encrypt_for_sentry("hello")
|
|
38
|
+
end
|
|
39
|
+
|
|
36
40
|
def test_encryption_with_random_padding
|
|
37
41
|
# system works with unsaved record
|
|
38
42
|
u = User.new :login => 'jones'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: loyal3-sentry
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- John Pelly
|
|
@@ -10,7 +10,7 @@ autorequire:
|
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
12
|
|
|
13
|
-
date: 2009-
|
|
13
|
+
date: 2009-08-04 00:00:00 -07:00
|
|
14
14
|
default_executable:
|
|
15
15
|
dependencies: []
|
|
16
16
|
|
|
@@ -55,7 +55,7 @@ files:
|
|
|
55
55
|
- test/symmetric_sentry_callback_test.rb
|
|
56
56
|
- test/symmetric_sentry_test.rb
|
|
57
57
|
- test/tests.rb
|
|
58
|
-
has_rdoc:
|
|
58
|
+
has_rdoc: true
|
|
59
59
|
homepage: http://github.com/pivotal/sentry
|
|
60
60
|
licenses:
|
|
61
61
|
post_install_message:
|
|
@@ -80,7 +80,7 @@ requirements: []
|
|
|
80
80
|
rubyforge_project:
|
|
81
81
|
rubygems_version: 1.3.5
|
|
82
82
|
signing_key:
|
|
83
|
-
specification_version:
|
|
83
|
+
specification_version: 2
|
|
84
84
|
summary: Asymmetric encryption of active record fields
|
|
85
85
|
test_files:
|
|
86
86
|
- test/abstract_unit.rb
|