gibberish 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.yardoc/checksums +4 -4
- data/.yardoc/objects/root.dat +0 -0
- data/README.markdown +12 -5
- data/Rakefile +10 -7
- data/lib/gibberish/aes.rb +2 -6
- data/lib/gibberish/rsa.rb +1 -1
- data/lib/gibberish/version.rb +1 -1
- metadata +3 -6
- data/Gemfile.lock +0 -19
data/.gitignore
CHANGED
data/.yardoc/checksums
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
lib/gibberish.rb 802b1397065b8f34b094cd5e797446a42c2c9b7e
|
2
|
-
lib/gibberish/rsa.rb
|
2
|
+
lib/gibberish/rsa.rb 84ee338b25ac16484c1b652b63c802a8085c9a82
|
3
3
|
lib/gibberish/aes.rb c0f393617c375e47516948a7540eb2bd9f9a261c
|
4
|
-
lib/gibberish/hmac.rb
|
5
|
-
lib/gibberish/digest.rb
|
6
|
-
lib/gibberish/version.rb
|
4
|
+
lib/gibberish/hmac.rb 51804f85036f2bea4885506ea92ec5b4d88e1486
|
5
|
+
lib/gibberish/digest.rb 7ba5c16118b415ac12ef1aadbe11ca95e5d73902
|
6
|
+
lib/gibberish/version.rb d2287491a538f55ab0e5d861eaf18da07ab46c89
|
data/.yardoc/objects/root.dat
CHANGED
Binary file
|
data/README.markdown
CHANGED
@@ -43,7 +43,7 @@ Gibberish AES is fully compatible with default OpenSSL on the command line
|
|
43
43
|
echo "U2FsdGVkX187oKRbgDkUcMKaFfB5RsXQj/X4mc8X3lsUVgwb4+S55LQo6f6N\nIDMX\n" | \
|
44
44
|
openssl enc -d -aes-256-cbc -a -k p4ssw0rd
|
45
45
|
|
46
|
-
[Find out more](http://
|
46
|
+
[Find out more](http://mdp.github.com/gibberish/Gibberish/AES.html)
|
47
47
|
|
48
48
|
## RSA
|
49
49
|
|
@@ -55,16 +55,16 @@ Gibberish AES is fully compatible with default OpenSSL on the command line
|
|
55
55
|
cipher = Gibberish::RSA.new(k.private_key)
|
56
56
|
dec = cipher.decrypt(enc)
|
57
57
|
|
58
|
-
[Find out more](http://
|
58
|
+
[Find out more](http://mdp.github.com/gibberish/Gibberish/RSA.html)
|
59
59
|
|
60
60
|
## HMAC
|
61
61
|
|
62
|
-
Defaults to
|
62
|
+
Defaults to 128 bit digest
|
63
63
|
|
64
64
|
Gibberish::HMAC("key", "some data")
|
65
65
|
#=> 521677c580722c5c52fa15d978e8656341c4f3c5
|
66
66
|
|
67
|
-
[Find out more](http://
|
67
|
+
[Find out more](http://mdp.github.com/gibberish/Gibberish/HMAC.html)
|
68
68
|
|
69
69
|
## Digests
|
70
70
|
|
@@ -77,7 +77,14 @@ Defaults to 256 bit digest
|
|
77
77
|
Gibberish::SHA256("somedata")
|
78
78
|
#=> 87d149cb424c0387656f211d2589fb5b1e16229921309e98588419ccca8a7362
|
79
79
|
|
80
|
-
[Find out more](http://
|
80
|
+
[Find out more](http://mdp.github.com/gibberish/Gibberish/Digest.html)
|
81
|
+
|
82
|
+
## Run the tests
|
83
|
+
|
84
|
+
git clone https://github.com/mdp/gibberish.git
|
85
|
+
cd gibberish
|
86
|
+
bundle install
|
87
|
+
rake test
|
81
88
|
|
82
89
|
## TODO
|
83
90
|
|
data/Rakefile
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
desc "run specs"
|
2
|
+
task :spec do
|
3
|
+
$LOAD_PATH.unshift '.', 'spec', 'lib'
|
4
|
+
require 'spec/spec_helper'
|
5
|
+
MiniTest::Unit.autorun
|
6
|
+
Dir.glob('spec/**/*_spec.rb') do |file|
|
7
|
+
load file
|
8
|
+
end
|
6
9
|
end
|
7
|
-
|
8
|
-
|
10
|
+
|
11
|
+
task :test => :spec
|
data/lib/gibberish/aes.rb
CHANGED
@@ -42,17 +42,13 @@ module Gibberish
|
|
42
42
|
setup_cipher(:encrypt, salt)
|
43
43
|
e = cipher.update(data) + cipher.final
|
44
44
|
e = "Salted__#{salt}#{e}" #OpenSSL compatible
|
45
|
-
|
46
|
-
e
|
47
|
-
else
|
48
|
-
Base64.encode64(e)
|
49
|
-
end
|
45
|
+
opts[:binary] ? e : Base64.encode64(e)
|
50
46
|
end
|
51
47
|
alias :enc :encrypt
|
52
48
|
alias :e :encrypt
|
53
49
|
|
54
50
|
def decrypt(data, opts={})
|
55
|
-
data = Base64.decode64(data)
|
51
|
+
data = Base64.decode64(data) unless opts[:binary]
|
56
52
|
salt = data[8..15]
|
57
53
|
data = data[16..-1]
|
58
54
|
setup_cipher(:decrypt, salt)
|
data/lib/gibberish/rsa.rb
CHANGED
@@ -73,7 +73,7 @@ module Gibberish
|
|
73
73
|
# Expects a public key at the minumum
|
74
74
|
#
|
75
75
|
# @param [#to_s] key public or private
|
76
|
-
# @
|
76
|
+
# @param [String] passphrase to key
|
77
77
|
#
|
78
78
|
def initialize(key, passphrase=nil)
|
79
79
|
@key = OpenSSL::PKey::RSA.new(key.to_s, passphrase)
|
data/lib/gibberish/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: gibberish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Mark Percival
|
@@ -10,8 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
14
|
-
default_executable:
|
13
|
+
date: 2011-05-16 00:00:00 Z
|
15
14
|
dependencies: []
|
16
15
|
|
17
16
|
description: Supports OpenSSL compatible AES, HMAC, and RSA encryption
|
@@ -31,7 +30,6 @@ files:
|
|
31
30
|
- .yardoc/proxy_types
|
32
31
|
- .yardopts
|
33
32
|
- Gemfile
|
34
|
-
- Gemfile.lock
|
35
33
|
- README.markdown
|
36
34
|
- Rakefile
|
37
35
|
- gibberish.gemspec
|
@@ -50,7 +48,6 @@ files:
|
|
50
48
|
- spec/openssl/public.pem
|
51
49
|
- spec/rsa_spec.rb
|
52
50
|
- spec/spec_helper.rb
|
53
|
-
has_rdoc: true
|
54
51
|
homepage: http://github.com/mdp/gibberish
|
55
52
|
licenses: []
|
56
53
|
|
@@ -74,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
71
|
requirements: []
|
75
72
|
|
76
73
|
rubyforge_project: gibberish
|
77
|
-
rubygems_version: 1.
|
74
|
+
rubygems_version: 1.7.2
|
78
75
|
signing_key:
|
79
76
|
specification_version: 3
|
80
77
|
summary: An opinionated ruby encryption library
|
data/Gemfile.lock
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
gibberish (1.0.0)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: http://rubygems.org/
|
8
|
-
specs:
|
9
|
-
mini_shoulda (0.2.0)
|
10
|
-
minitest (~> 2.0.2)
|
11
|
-
minitest (2.0.2)
|
12
|
-
|
13
|
-
PLATFORMS
|
14
|
-
ruby
|
15
|
-
|
16
|
-
DEPENDENCIES
|
17
|
-
gibberish!
|
18
|
-
mini_shoulda
|
19
|
-
minitest
|