gibberish 2.0.0 → 2.1.0

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: 6eca32966c5ac459d70f832120c67175359ab581
4
- data.tar.gz: 9ea06902e68d9e6c71410e9f6b79ce42642c46d4
3
+ metadata.gz: b8f6e39b2f444cc63b01d4c85de9ae56e4de94a8
4
+ data.tar.gz: 943a5d8455da5d8abd7e94fea764c636f5499303
5
5
  SHA512:
6
- metadata.gz: 036a7424a015301eb8df8f95bdfa50d924aa9aa0589667d6795bd01ca5db791572a9f0b5015d357ec1cd61d3cbe09b9686d28b0ff9ed0d46c7276d231b13943e
7
- data.tar.gz: 119793a0005f102286c3a79b389e539952b4015c739b5269862028a8fc4e4656d32bbb31c1cb277e0f4b6ae8b6b278819604c97ad64f3ff5f60e83737a390488
6
+ metadata.gz: b97bcb2a0af4b5e1c842b947f3678fda57af645086f8369b609c512849f3c9742e227928662eaf313f1d9fec2dc29ea5b0899145cdd3a7257c0fcb0d611ef1cf
7
+ data.tar.gz: 224bc3bfc9dd905ee26a74c2eb62f1bfa76124231588e4b021a8df7a867f74b9d7a0639ee86a1ef7821c8cce416df64ae1ccfe20bf1c546597348f817aba4455
@@ -1,3 +1,6 @@
1
+ ### v2.1.0
2
+ * Improve exception handling [PR#25](https://github.com/mdp/gibberish/pull/25)
3
+
1
4
  ### v2.0.0
2
5
  * Breaking changes to default AES mode
3
6
  - Moving to [SJCL](http://bitwiseshiftleft.github.io/sjcl/) compatible AES
@@ -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
@@ -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.message}"
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
@@ -1,3 +1,3 @@
1
1
  module Gibberish
2
- VERSION = "2.0.0"
2
+ VERSION = "2.1.0"
3
3
  end
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.0.0
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: 2015-04-06 00:00:00.000000000 Z
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: