gibberish 2.0.0 → 2.1.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.mdown +3 -0
- data/README.markdown +0 -12
- data/lib/gibberish/aes.rb +4 -4
- data/lib/gibberish/version.rb +1 -1
- metadata +15 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8f6e39b2f444cc63b01d4c85de9ae56e4de94a8
|
4
|
+
data.tar.gz: 943a5d8455da5d8abd7e94fea764c636f5499303
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b97bcb2a0af4b5e1c842b947f3678fda57af645086f8369b609c512849f3c9742e227928662eaf313f1d9fec2dc29ea5b0899145cdd3a7257c0fcb0d611ef1cf
|
7
|
+
data.tar.gz: 224bc3bfc9dd905ee26a74c2eb62f1bfa76124231588e4b021a8df7a867f74b9d7a0639ee86a1ef7821c8cce416df64ae1ccfe20bf1c546597348f817aba4455
|
data/CHANGELOG.mdown
CHANGED
data/README.markdown
CHANGED
@@ -87,18 +87,6 @@ by calling it explicitly:
|
|
87
87
|
|
88
88
|
[See the full docs](http://www.rubydoc.info/github/mdp/gibberish/Gibberish/Digest)
|
89
89
|
|
90
|
-
## RSA
|
91
|
-
|
92
|
-
k = Gibberish::RSA.generate_keypair(2048)
|
93
|
-
cipher = Gibberish::RSA.new(k.public_key)
|
94
|
-
enc = cipher.encrypt("Some data")
|
95
|
-
# Defaults to Base64 output
|
96
|
-
#=> "JKm98wKyJljqmpx7kP8ZsdeXiShllEMcRHVnjUjc4ecyYK/doKAkVTLho1Gp\ng697qrljyClF0AcIH+XZmeF/TrqYUuCEUyhOD6OL1bs5dn8vFQefS5KdaC5Y\ndLADvh3mSfE/w/gs4vaf/OtbZNBeSl6ROCZasWTfRewp4n1RDmE=\n"
|
97
|
-
cipher = Gibberish::RSA.new(k.private_key)
|
98
|
-
dec = cipher.decrypt(enc)
|
99
|
-
|
100
|
-
[See the full docs](http://mdp.github.com/gibberish/Gibberish/RSA.html)
|
101
|
-
|
102
90
|
## Run the tests
|
103
91
|
|
104
92
|
git clone https://github.com/mdp/gibberish.git
|
data/lib/gibberish/aes.rb
CHANGED
@@ -158,8 +158,8 @@ module Gibberish
|
|
158
158
|
def decrypt(h)
|
159
159
|
begin
|
160
160
|
h = JSON.parse(h, {:symbolize_names => true})
|
161
|
-
rescue
|
162
|
-
raise "Unable to parse JSON of crypted text"
|
161
|
+
rescue => e
|
162
|
+
raise "Unable to parse JSON of crypted text. #{e.inspect}"
|
163
163
|
end
|
164
164
|
check_cipher_options(h)
|
165
165
|
key = OpenSSL::PKCS5.pbkdf2_hmac(@password, Base64.decode64(h[:salt]), h[:iter], h[:ks]/8, 'SHA256')
|
@@ -171,7 +171,7 @@ module Gibberish
|
|
171
171
|
begin
|
172
172
|
c = OpenSSL::Cipher.new(cipherMode)
|
173
173
|
rescue RuntimeError => e
|
174
|
-
raise "OpenSSL error when initializing: #{e.
|
174
|
+
raise "OpenSSL error when initializing: #{e.inspect}"
|
175
175
|
end
|
176
176
|
c.decrypt
|
177
177
|
c.key = key
|
@@ -181,7 +181,7 @@ module Gibberish
|
|
181
181
|
begin
|
182
182
|
out = c.update(ct) + c.final();
|
183
183
|
rescue OpenSSL::Cipher::CipherError => e
|
184
|
-
raise DecryptionError.new();
|
184
|
+
raise DecryptionError.new(e.inspect);
|
185
185
|
end
|
186
186
|
return Plaintext.new(out.force_encoding('utf-8'), h[:adata])
|
187
187
|
end
|
data/lib/gibberish/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gibberish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Percival
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Supports SJCL compatible AES encryption, HMAC, and Digests
|
14
14
|
email:
|
@@ -70,5 +70,17 @@ rubygems_version: 2.2.2
|
|
70
70
|
signing_key:
|
71
71
|
specification_version: 4
|
72
72
|
summary: An opinionated ruby encryption library
|
73
|
-
test_files:
|
73
|
+
test_files:
|
74
|
+
- spec/aes_benchmark.rb
|
75
|
+
- spec/aes_spec.rb
|
76
|
+
- spec/digest_spec.rb
|
77
|
+
- spec/fixtures/secret.txt
|
78
|
+
- spec/hmac_spec.rb
|
79
|
+
- spec/openssl/plaintext.aes
|
80
|
+
- spec/openssl/plaintext.crypted
|
81
|
+
- spec/openssl/plaintext.txt
|
82
|
+
- spec/openssl/private.pem
|
83
|
+
- spec/openssl/public.pem
|
84
|
+
- spec/rsa_spec.rb
|
85
|
+
- spec/spec_helper.rb
|
74
86
|
has_rdoc:
|