shipstar-sentry 0.5.2.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/CHANGELOG +58 -0
- data/MIT-LICENSE +20 -0
- data/README +94 -0
- data/RUNNING_UNIT_TESTS +42 -0
- data/Rakefile +192 -0
- data/VERSION +1 -0
- data/init.rb +1 -0
- data/lib/active_record/sentry.rb +102 -0
- data/lib/sentry.rb +71 -0
- data/lib/sentry/asymmetric_sentry.rb +190 -0
- data/lib/sentry/asymmetric_sentry_callback.rb +17 -0
- data/lib/sentry/sha_sentry.rb +41 -0
- data/lib/sentry/symmetric_sentry.rb +77 -0
- data/lib/sentry/symmetric_sentry_callback.rb +17 -0
- data/sentry.gemspec +79 -0
- data/tasks/sentry.rake +9 -0
- data/test/abstract_unit.rb +44 -0
- data/test/asymmetric_sentry_callback_test.rb +122 -0
- data/test/asymmetric_sentry_test.rb +97 -0
- data/test/database.yml +18 -0
- data/test/fixtures/user.rb +26 -0
- data/test/fixtures/users.yml +9 -0
- data/test/keys/encrypted_private +12 -0
- data/test/keys/encrypted_public +4 -0
- data/test/keys/private +9 -0
- data/test/keys/public +4 -0
- data/test/rsa_key_test.rb +11 -0
- data/test/schema.rb +10 -0
- data/test/sha_sentry_test.rb +35 -0
- data/test/symmetric_sentry_callback_test.rb +38 -0
- data/test/symmetric_sentry_test.rb +37 -0
- data/test/tests.rb +2 -0
- metadata +93 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'abstract_unit'
|
|
2
|
+
|
|
3
|
+
class SymmetricSentryTest < Test::Unit::TestCase
|
|
4
|
+
def setup
|
|
5
|
+
@str = 'sentry'
|
|
6
|
+
@key = 'secret'
|
|
7
|
+
@encrypted = "td9jRyjyv0A=\n"
|
|
8
|
+
@sentry = Sentry::SymmetricSentry.new
|
|
9
|
+
Sentry::SymmetricSentry.default_key = nil
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_should_encrypt
|
|
13
|
+
assert_equal @encrypted, @sentry.encrypt_to_base64(@str, @key)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def test_should_decrypt
|
|
17
|
+
assert_equal @str, @sentry.decrypt_from_base64(@encrypted, @key)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def test_should_encrypt_with_default_key
|
|
21
|
+
Sentry::SymmetricSentry.default_key = @key
|
|
22
|
+
assert_equal @encrypted, @sentry.encrypt_to_base64(@str)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_should_decrypt_with_default_key
|
|
26
|
+
Sentry::SymmetricSentry.default_key = @key
|
|
27
|
+
assert_equal @str, @sentry.decrypt_from_base64(@encrypted)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def test_should_raise_error_when_encrypt_with_no_key
|
|
31
|
+
assert_raises(Sentry::NoKeyError) { @sentry.encrypt_to_base64(@str) }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def test_should_raise_error_when_decrypt_with_no_key
|
|
35
|
+
assert_raises(Sentry::NoKeyError) { @sentry.decrypt_from_base64(@str) }
|
|
36
|
+
end
|
|
37
|
+
end
|
data/test/tests.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: shipstar-sentry
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.5.2.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Kyle Shipley
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
|
|
12
|
+
date: 2009-08-19 00:00:00 -07:00
|
|
13
|
+
default_executable:
|
|
14
|
+
dependencies: []
|
|
15
|
+
|
|
16
|
+
description: Asymmetric encryption of active record fields
|
|
17
|
+
email: shipstar@gmail.com
|
|
18
|
+
executables: []
|
|
19
|
+
|
|
20
|
+
extensions: []
|
|
21
|
+
|
|
22
|
+
extra_rdoc_files:
|
|
23
|
+
- README
|
|
24
|
+
files:
|
|
25
|
+
- CHANGELOG
|
|
26
|
+
- MIT-LICENSE
|
|
27
|
+
- README
|
|
28
|
+
- RUNNING_UNIT_TESTS
|
|
29
|
+
- Rakefile
|
|
30
|
+
- VERSION
|
|
31
|
+
- init.rb
|
|
32
|
+
- lib/active_record/sentry.rb
|
|
33
|
+
- lib/sentry.rb
|
|
34
|
+
- lib/sentry/asymmetric_sentry.rb
|
|
35
|
+
- lib/sentry/asymmetric_sentry_callback.rb
|
|
36
|
+
- lib/sentry/sha_sentry.rb
|
|
37
|
+
- lib/sentry/symmetric_sentry.rb
|
|
38
|
+
- lib/sentry/symmetric_sentry_callback.rb
|
|
39
|
+
- sentry.gemspec
|
|
40
|
+
- tasks/sentry.rake
|
|
41
|
+
- test/abstract_unit.rb
|
|
42
|
+
- test/asymmetric_sentry_callback_test.rb
|
|
43
|
+
- test/asymmetric_sentry_test.rb
|
|
44
|
+
- test/database.yml
|
|
45
|
+
- test/fixtures/user.rb
|
|
46
|
+
- test/fixtures/users.yml
|
|
47
|
+
- test/keys/encrypted_private
|
|
48
|
+
- test/keys/encrypted_public
|
|
49
|
+
- test/keys/private
|
|
50
|
+
- test/keys/public
|
|
51
|
+
- test/rsa_key_test.rb
|
|
52
|
+
- test/schema.rb
|
|
53
|
+
- test/sha_sentry_test.rb
|
|
54
|
+
- test/symmetric_sentry_callback_test.rb
|
|
55
|
+
- test/symmetric_sentry_test.rb
|
|
56
|
+
- test/tests.rb
|
|
57
|
+
has_rdoc: false
|
|
58
|
+
homepage: http://github.com/shipstar/sentry
|
|
59
|
+
post_install_message:
|
|
60
|
+
rdoc_options:
|
|
61
|
+
- --charset=UTF-8
|
|
62
|
+
require_paths:
|
|
63
|
+
- lib
|
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: "0"
|
|
69
|
+
version:
|
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: "0"
|
|
75
|
+
version:
|
|
76
|
+
requirements: []
|
|
77
|
+
|
|
78
|
+
rubyforge_project:
|
|
79
|
+
rubygems_version: 1.2.0
|
|
80
|
+
signing_key:
|
|
81
|
+
specification_version: 3
|
|
82
|
+
summary: Asymmetric encryption of active record fields
|
|
83
|
+
test_files:
|
|
84
|
+
- test/abstract_unit.rb
|
|
85
|
+
- test/asymmetric_sentry_callback_test.rb
|
|
86
|
+
- test/asymmetric_sentry_test.rb
|
|
87
|
+
- test/fixtures/user.rb
|
|
88
|
+
- test/rsa_key_test.rb
|
|
89
|
+
- test/schema.rb
|
|
90
|
+
- test/sha_sentry_test.rb
|
|
91
|
+
- test/symmetric_sentry_callback_test.rb
|
|
92
|
+
- test/symmetric_sentry_test.rb
|
|
93
|
+
- test/tests.rb
|