symmetric-encryption 3.0.2 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9372dc10ff0f61fac4ce5b15b1166c12e0623e1
|
4
|
+
data.tar.gz: b5953a44d66dff085cd6417622bad5e0ca7cdeb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bb09ce303a73a7031f4c8b6f8561ed3fd60239cdd75d7ad8251bdcb4708273d21207f2ae007fb1898ecc00e6b8fefbf6a7b318577105eee009da2825e2aee43
|
7
|
+
data.tar.gz: 1e579b442711e49ac774efcd53cf453a862e6917e1469053fe52fc310cf114059ee5c121a60d0e3243016fcb8b2234fffa4f63e987c4e4cc7646fc8dbf88e230
|
@@ -81,7 +81,7 @@ module SymmetricEncryption
|
|
81
81
|
# successfully returns a string of data
|
82
82
|
def self.decrypt(encrypted_and_encoded_string, version=nil)
|
83
83
|
raise "Call SymmetricEncryption.load! or SymmetricEncryption.cipher= prior to encrypting or decrypting data" unless @@cipher
|
84
|
-
return if encrypted_and_encoded_string.nil? || (encrypted_and_encoded_string == '')
|
84
|
+
return encrypted_and_encoded_string if encrypted_and_encoded_string.nil? || (encrypted_and_encoded_string == '')
|
85
85
|
|
86
86
|
str = encrypted_and_encoded_string.to_s
|
87
87
|
|
data/test/cipher_test.rb
CHANGED
@@ -77,6 +77,22 @@ class CipherTest < Test::Unit::TestCase
|
|
77
77
|
assert_equal @social_security_number_encrypted, @cipher.encrypt(@social_security_number)
|
78
78
|
end
|
79
79
|
|
80
|
+
should "return nil when encrypting nil" do
|
81
|
+
assert_equal nil, @cipher.encrypt(nil)
|
82
|
+
end
|
83
|
+
|
84
|
+
should "return '' when encrypting ''" do
|
85
|
+
assert_equal '', @cipher.encrypt('')
|
86
|
+
end
|
87
|
+
|
88
|
+
should "return nil when decrypting nil" do
|
89
|
+
assert_equal nil, @cipher.decrypt(nil)
|
90
|
+
end
|
91
|
+
|
92
|
+
should "return '' when decrypting ''" do
|
93
|
+
assert_equal '', @cipher.decrypt('')
|
94
|
+
end
|
95
|
+
|
80
96
|
should "decrypt string" do
|
81
97
|
assert_equal @social_security_number, @cipher.decrypt(@social_security_number_encrypted)
|
82
98
|
end
|
@@ -83,6 +83,22 @@ class SymmetricEncryptionTest < Test::Unit::TestCase
|
|
83
83
|
assert_equal @social_security_number, SymmetricEncryption.decrypt(@social_security_number_encrypted)
|
84
84
|
end
|
85
85
|
|
86
|
+
should "return nil when encrypting nil" do
|
87
|
+
assert_equal nil, SymmetricEncryption.encrypt(nil)
|
88
|
+
end
|
89
|
+
|
90
|
+
should "return '' when encrypting ''" do
|
91
|
+
assert_equal '', SymmetricEncryption.encrypt('')
|
92
|
+
end
|
93
|
+
|
94
|
+
should "return nil when decrypting nil" do
|
95
|
+
assert_equal nil, SymmetricEncryption.decrypt(nil)
|
96
|
+
end
|
97
|
+
|
98
|
+
should "return '' when decrypting ''" do
|
99
|
+
assert_equal '', SymmetricEncryption.decrypt('')
|
100
|
+
end
|
101
|
+
|
86
102
|
should "determine if string is encrypted" do
|
87
103
|
assert_equal true, SymmetricEncryption.encrypted?(@social_security_number_encrypted)
|
88
104
|
assert_equal false, SymmetricEncryption.encrypted?(@social_security_number)
|
data/test/test_db.sqlite3
CHANGED
Binary file
|