cript 0.0.3 → 0.0.4
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 +7 -0
- data/.travis.yml +1 -0
- data/README.md +5 -11
- data/lib/cript.rb +1 -4
- data/lib/cript/cripter.rb +22 -43
- data/lib/cript/ehash.rb +8 -4
- data/lib/cript/key_info.rb +59 -0
- data/lib/cript/naive.rb +0 -52
- data/lib/cript/store.rb +10 -7
- data/lib/cript/version.rb +1 -1
- data/spec/ehash_spec.rb +1 -1
- data/spec/naive_spec.rb +2 -3
- data/spec/simple_spec.rb +1 -2
- metadata +17 -25
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 90f3e92ed1a33ba2218e5e22dfc623d190cfaf10
|
|
4
|
+
data.tar.gz: cb952affc3f86d859acb5aaee30bc5c7930771ab
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: a63dfcdc9e85458c9b2e55746b275d686778dab8484b6bace6724096277b0c1e335a093766e591d1ae67ff47e4cd2eb721f5f8a0355bf1fe8e9de97ab8e29c66
|
|
7
|
+
data.tar.gz: 274864c4cd0d8761ae8976774865d8c927c494fb5531031d8a8c6cecc489b485d120ef03c3005937fe981994244accc219cf658e6864b29ec3c31cbdd3ee8397
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
|
@@ -45,13 +45,14 @@ Obviously, this will have performance implications.
|
|
|
45
45
|
|
|
46
46
|
Cript::Simple is a simple wrapper around the ruby openssl bindings.
|
|
47
47
|
Once created, you can call encrypt or decrypt on it to encrypt or decrypt strings.
|
|
48
|
-
It requires access to an RSA
|
|
49
|
-
|
|
48
|
+
It requires access to an an RSA private key. It can use only a public key if you're
|
|
49
|
+
doing one-way encryption.
|
|
50
|
+
If not provided at initialization, it will look in $HOME/.ssh/id_rsa and/or $HOME/.ssh/id_rsa.pub.
|
|
50
51
|
|
|
51
52
|
If you don't want to use your default ssh keys, you can pass in paths to a different key pair.
|
|
52
53
|
|
|
53
54
|
```ruby
|
|
54
|
-
c1 = Cript::Simple.new(
|
|
55
|
+
c1 = Cript::Simple.new(private_key_path: '/path/to/some/ssh_key')
|
|
55
56
|
plain = "More secret stuff!"
|
|
56
57
|
encrypted = c2.encrypt(plain)
|
|
57
58
|
decrypted = c2.decrypt(encrypted)
|
|
@@ -61,7 +62,6 @@ Or you can pass in the ssh keys as strings in PEM format:
|
|
|
61
62
|
|
|
62
63
|
```ruby
|
|
63
64
|
c2 = Cript::Simple.new({
|
|
64
|
-
public_key_content: "-----BEGIN PUBLIC KEY-----\nafaf...",
|
|
65
65
|
private_key_path: "-----BEGIN RSA PRIVATE KEY-----\n3f4q..."
|
|
66
66
|
})
|
|
67
67
|
encrypted = c.encrypt("More secret stuff!")
|
|
@@ -72,13 +72,7 @@ Type `cript --help` after gem installation for usage.
|
|
|
72
72
|
|
|
73
73
|
## TODO
|
|
74
74
|
|
|
75
|
-
[ ]
|
|
76
|
-
[ ] gpg encryption
|
|
77
|
-
[ ] plugable storage
|
|
78
|
-
[ ] ssh storage
|
|
79
|
-
[ ] s3 storage
|
|
80
|
-
[ ] google drive storage
|
|
81
|
-
[ ] drb storage
|
|
75
|
+
- [ ] gpg encryption option
|
|
82
76
|
|
|
83
77
|
## Contributing
|
|
84
78
|
|
data/lib/cript.rb
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
require "cript/version"
|
|
2
2
|
|
|
3
3
|
module Cript
|
|
4
|
-
|
|
5
|
-
PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArhk4ZdrUm73R8gIZ0w6o\nJpLvjjgu3YvKC3rWF6Hg9nmC52MdWD+L10LEKttfKai11s9E+qP+UwEjqq+VVqaT\nfQpgK/uwAw5t7UuBvYUqBN9J7ZoqfFOONTl6y86eEJYj1hkM7+/PP8r5G3C/FYw2\nAyuduAArWZixuBrdOY8umsUvqPGRKFJsvxfR3VGuL2Lq0YuaZlwPpmIimxFnGgpC\naRcFRlIPWfSm7AQgAe11bV/vXx+6KYNGYT+dQeXZZA38KDRha7ibJbX0q06izWz4\nj01Dzo/gKMwEzMegbCMq+XyAKPAjXZhr7HmrclUZyzo+iMP51G3mEriG1HA7NFac\n8QIDAQAB\n-----END PUBLIC KEY-----\n"
|
|
6
|
-
KEY_SIZE = 2048
|
|
4
|
+
INSECURE_PRIVATE_KEY = "-----BEGIN RSA PRIVATE KEY-----\nMIIEoQIBAAKCAQEArhk4ZdrUm73R8gIZ0w6oJpLvjjgu3YvKC3rWF6Hg9nmC52Md\nWD+L10LEKttfKai11s9E+qP+UwEjqq+VVqaTfQpgK/uwAw5t7UuBvYUqBN9J7Zoq\nfFOONTl6y86eEJYj1hkM7+/PP8r5G3C/FYw2AyuduAArWZixuBrdOY8umsUvqPGR\nKFJsvxfR3VGuL2Lq0YuaZlwPpmIimxFnGgpCaRcFRlIPWfSm7AQgAe11bV/vXx+6\nKYNGYT+dQeXZZA38KDRha7ibJbX0q06izWz4j01Dzo/gKMwEzMegbCMq+XyAKPAj\nXZhr7HmrclUZyzo+iMP51G3mEriG1HA7NFac8QIDAQABAoIBAHYxUQR1B5mjyIAP\nxRBwBuAJKPDYW5i0ajpY7jelAmDSJXiI5Ucf/QPqo9qki3pwuuJWXHH8G5CmWVxr\nT2tAMyjUfm3dtKSeiypp9G6BlQExxbK00tsMrqKbny3124FPLI0Q/KN3nq+kUHG8\nnT03rwN//NcJ5mQxMZXXRxDoj68pyHcCU6cMjweC1vEWMIABGTJVTxHfobIVmfI6\n8gnxdMxmkgyJHdKKwzztaKdDNl5ISlhtisnuF/cIT0dWBkAdO+aIgePPK0rOgCL8\nW/YZ8cSLSag7WJnPQPhODhGNsRXhDeemtZUD+MGJ4i0D/B5zXm3yRJhqrbkpiNDg\nO91InbECgYEA157UYoymjPaZk/Tz/5PpGte46oPTAztD56XIxdm7XPwITmeQ/qhs\nXeaN3n8wt/wAjilvtGSUna7wtJCHM/Y8iP6SHSP3Fa/24xuH9MtapzTGLgrk4guh\neG05tsAWjTiKfYpbtgs6cTbwQFkgJaiMNuymeg4yxX3h+AVw9H+nYK8CgYEAzrPE\na2I/LwBuyM5OWD2ztlEm5GkjADXdU6eUJEuuQZGh7fldXz82Ld1vOiRUN8LPBhCQ\nfvikid9ZBb2DqzdvkL0dMHw5kx6lV+8gPRScaSkD+g58MpUTv0NGKQM7nxdPSvPk\n7X72QwmqcnJbIS+Al6HpPVYmeFzqP2RE0wt5BF8Cfyr0eVsoqgVrGy1enz1LOiUe\n1LfjiyYZqG19mYHQ3oKnsv/rofcZln0ecSTiMdJ1YabwmlBVuUWwlENkh4rSgzzH\nelRT1eV8KLMVyP/7gxPMb668fNyLdJ+JIvZFTjjUCsL3zU127y2exD4Ng1n9OfG3\nM3MdYP/3FA1VCCutQqsCgYAlx0FdBwXZR1D4LoyvIAfaiJZ9JKIbBb0/7t7qi1J7\n9WwNHIhuQhVa6J/Nlpo13ssLprdiHXulH0cb/3kzL9yaLZZKKEo1k2JQ4gmYYE3+\nAlsRttgIPqrvSBJoqIibGR2K62yp44yK0Bdw92mkdRQhopwIc9hwIztE/sR9dhlW\nLQKBgQCjD01i0JTA+mKQk9zPQzduDfTqMx5DVRqndROaKkqpgasMb5wBCSCWddlS\nJRWbl6Yiwv5AZMcYWw5zjd83w7zD/XiQYGxLF2oVbWXFl/65Qxj0Oum/TWM32+LH\n2oUSPzpyvmzM16o7vHW+1sPIaPGt/y63UzKXqf4kJrs6Wy5ipQ==\n-----END RSA PRIVATE KEY-----\n"
|
|
7
5
|
end
|
|
8
6
|
|
|
9
7
|
require "cript/cripter"
|
|
10
8
|
require "cript/simple"
|
|
11
|
-
require "cript/naive"
|
|
12
9
|
require "cript/store"
|
|
13
10
|
require "cript/ehash"
|
data/lib/cript/cripter.rb
CHANGED
|
@@ -12,29 +12,39 @@ module Cript
|
|
|
12
12
|
|
|
13
13
|
# Build a new cripter
|
|
14
14
|
#
|
|
15
|
-
#
|
|
15
|
+
# opts:
|
|
16
16
|
# public_key_content
|
|
17
17
|
# private_key_content
|
|
18
18
|
# public_key_path
|
|
19
19
|
# private_key_path
|
|
20
20
|
# passphrase
|
|
21
|
-
def initialize(
|
|
22
|
-
@
|
|
21
|
+
def initialize(opts = {})
|
|
22
|
+
@opts = opts
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
# Attempt to use the private key at the default location
|
|
25
|
+
# if exists and not otherwise specified
|
|
26
|
+
unless [:private_key_content, :private_key_path].any? { |o| @opts[o] }
|
|
25
27
|
if File.file?("#{ENV['HOME']}/.ssh/id_rsa")
|
|
26
|
-
@
|
|
27
|
-
end
|
|
28
|
-
if File.file?("#{ENV['HOME']}/.ssh/id_rsa.pub")
|
|
29
|
-
@opt[:public_key_path] = "#{ENV['HOME']}/.ssh/id_rsa.pub"
|
|
28
|
+
@opts[:private_key_path] = "#{ENV['HOME']}/.ssh/id_rsa"
|
|
30
29
|
end
|
|
31
30
|
end
|
|
32
31
|
|
|
33
|
-
if [:private_key_content
|
|
34
|
-
@private_key = OpenSSL::PKey::RSA.new(*[
|
|
32
|
+
if @opts[:private_key_content]
|
|
33
|
+
@private_key = OpenSSL::PKey::RSA.new(*[@opts[:private_key_content], @opts.delete(:passphrase)])
|
|
34
|
+
elsif @opts[:private_key_path] && File.file?(@opts[:private_key_path])
|
|
35
|
+
@private_key = OpenSSL::PKey::RSA.new(*[File.read(@opts[:private_key_path]), @opts.delete(:passphrase)])
|
|
35
36
|
end
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
|
|
38
|
+
if @private_key
|
|
39
|
+
@public_key = @private_key.public_key
|
|
40
|
+
else
|
|
41
|
+
if @opts[:public_key_content]
|
|
42
|
+
@public_key = OpenSSL::PKey::RSA.new(@opts[:public_key_content])
|
|
43
|
+
elsif @opts[:public_key_path] && File.file?(@opts[:public_key_path])
|
|
44
|
+
@public_key = OpenSSL::PKey::RSA.new(File.read(@opts[:public_key_path]))
|
|
45
|
+
elsif File.file?("#{ENV['HOME']}/.ssh/id_rsa.pub")
|
|
46
|
+
@public_key = OpenSSL::PKey::RSA.new(File.read("#{ENV['HOME']}/.ssh/id_rsa.pub"))
|
|
47
|
+
end
|
|
38
48
|
end
|
|
39
49
|
end
|
|
40
50
|
|
|
@@ -54,36 +64,5 @@ module Cript
|
|
|
54
64
|
decrypt(encrypt(message))
|
|
55
65
|
end
|
|
56
66
|
|
|
57
|
-
private
|
|
58
|
-
|
|
59
|
-
def key_content(type = :public)
|
|
60
|
-
type = :private unless type == :public
|
|
61
|
-
if @opt[:"#{type}_key_content"]
|
|
62
|
-
@opt[:"#{type}_key_content"]
|
|
63
|
-
elsif @opt[:"#{type}_key_path"]
|
|
64
|
-
content = File.read(@opt[:"#{type}_key_path"])
|
|
65
|
-
if content.include?("#{type.to_s.upcase} KEY")
|
|
66
|
-
content
|
|
67
|
-
else
|
|
68
|
-
ssh_key_to_pem(@opt[:"#{type}_key_path"])
|
|
69
|
-
end
|
|
70
|
-
else
|
|
71
|
-
raise Cript::Cripter::Error, "No #{type} key content"
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def ssh_key_to_pem(path)
|
|
76
|
-
ssh_keygen("-f \"#{path}\" -e -m pem")
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def ssh_keygen(cmd)
|
|
80
|
-
ssh_keygen = %x{ which ssh-keygen }.to_s.strip
|
|
81
|
-
if ssh_keygen != ""
|
|
82
|
-
%x{ #{ssh_keygen} #{cmd} }.to_s.strip
|
|
83
|
-
else
|
|
84
|
-
raise "ssh-keygen not available"
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
67
|
end
|
|
89
68
|
end
|
data/lib/cript/ehash.rb
CHANGED
|
@@ -10,8 +10,8 @@ module Cript
|
|
|
10
10
|
METHODS = Hash.new.methods - Object.new.methods
|
|
11
11
|
KEY = :data
|
|
12
12
|
|
|
13
|
-
def initialize(file,
|
|
14
|
-
@store = Store.new(file,
|
|
13
|
+
def initialize(file, opts = {})
|
|
14
|
+
@store = Store.new(file, opts)
|
|
15
15
|
@store.transaction do
|
|
16
16
|
unless @store[KEY].is_a?(Hash)
|
|
17
17
|
@store[KEY] = {}
|
|
@@ -19,6 +19,10 @@ module Cript
|
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
+
def self.insecure(file, opts = {})
|
|
23
|
+
new(file, opts.merge({ private_key_content: INSECURE_PRIVATE_KEY }))
|
|
24
|
+
end
|
|
25
|
+
|
|
22
26
|
def inspect
|
|
23
27
|
"#<#{self.class.name} path='#{@store.path}'>"
|
|
24
28
|
end
|
|
@@ -31,8 +35,8 @@ module Cript
|
|
|
31
35
|
end
|
|
32
36
|
end
|
|
33
37
|
|
|
34
|
-
def
|
|
35
|
-
METHODS.include?(sym)
|
|
38
|
+
def respond_to_missing?(sym, include_private = false)
|
|
39
|
+
METHODS.include?(sym) || super
|
|
36
40
|
end
|
|
37
41
|
|
|
38
42
|
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module Cript
|
|
2
|
+
class KeyInfo
|
|
3
|
+
def ssh_key_to_pem(path)
|
|
4
|
+
ssh_keygen("-f \"#{path}\" -e -m pem")
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def ssh_keygen(cmd)
|
|
8
|
+
ssh_keygen = %x{ which ssh-keygen }.to_s.strip
|
|
9
|
+
if ssh_keygen != ""
|
|
10
|
+
%x{ #{ssh_keygen} #{cmd} }.to_s.strip
|
|
11
|
+
else
|
|
12
|
+
raise "ssh-keygen not available"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def type
|
|
17
|
+
@opt[:type] || key_info[:type]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def size
|
|
21
|
+
@opt[:size] || key_info[:size]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def fingerprint
|
|
25
|
+
@opt[:fingerprint] || key_info[:fingerprint]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def comment
|
|
29
|
+
@opt[:comment] || key_info[:comment]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def key_content(type = :public)
|
|
33
|
+
type = :private unless type == :public
|
|
34
|
+
if @opt[:"#{type}_key_content"]
|
|
35
|
+
@opt[:"#{type}_key_content"]
|
|
36
|
+
elsif @opt[:"#{type}_key_path"]
|
|
37
|
+
content = File.read(@opt[:"#{type}_key_path"])
|
|
38
|
+
if content.include?("#{type.to_s.upcase} KEY")
|
|
39
|
+
content
|
|
40
|
+
else
|
|
41
|
+
ssh_key_to_pem(@opt[:"#{type}_key_path"])
|
|
42
|
+
end
|
|
43
|
+
else
|
|
44
|
+
raise Cript::Cripter::Error, "No #{type} key content"
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def key_info
|
|
49
|
+
@key_info ||= begin
|
|
50
|
+
if @opt[:public_key_path]
|
|
51
|
+
info = ssh_keygen("-l -f \"#{@opt[:public_key_path]}\"").split(/[\s]+/)
|
|
52
|
+
if info.length == 4
|
|
53
|
+
{ size: info[0].to_i, fingerprint: info[1], comment: info[2], type: info[3].match(/([\w]+)/)[1].downcase }
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
data/lib/cript/naive.rb
CHANGED
|
@@ -10,45 +10,6 @@ module Cript
|
|
|
10
10
|
# Performance is poor because rsa public keys were not meant to do this.
|
|
11
11
|
class Naive < Cripter
|
|
12
12
|
|
|
13
|
-
class Error < StandardError; end
|
|
14
|
-
|
|
15
|
-
# Options:
|
|
16
|
-
# public_key_content
|
|
17
|
-
# private_key_content
|
|
18
|
-
#
|
|
19
|
-
# public_key_path
|
|
20
|
-
# private_key_path
|
|
21
|
-
#
|
|
22
|
-
# passphrase
|
|
23
|
-
#
|
|
24
|
-
# type
|
|
25
|
-
# size
|
|
26
|
-
# fingerprint
|
|
27
|
-
# comment
|
|
28
|
-
def initialize(options = {})
|
|
29
|
-
super
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def inspect
|
|
33
|
-
"#<#{self.class.name} path=#{@opt[:public_key_path]}>"
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def type
|
|
37
|
-
@opt[:type] || key_info[:type]
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def size
|
|
41
|
-
@opt[:size] || key_info[:size]
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def fingerprint
|
|
45
|
-
@opt[:fingerprint] || key_info[:fingerprint]
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def comment
|
|
49
|
-
@opt[:comment] || key_info[:comment]
|
|
50
|
-
end
|
|
51
|
-
|
|
52
13
|
def encrypt(message)
|
|
53
14
|
Base64::encode64(
|
|
54
15
|
message.
|
|
@@ -66,18 +27,5 @@ module Cript
|
|
|
66
27
|
join
|
|
67
28
|
end
|
|
68
29
|
|
|
69
|
-
private
|
|
70
|
-
|
|
71
|
-
def key_info
|
|
72
|
-
@key_info ||= begin
|
|
73
|
-
if @opt[:public_key_path]
|
|
74
|
-
info = ssh_keygen("-l -f \"#{@opt[:public_key_path]}\"").split(/[\s]+/)
|
|
75
|
-
if info.length == 4
|
|
76
|
-
{ size: info[0].to_i, fingerprint: info[1], comment: info[2], type: info[3].match(/([\w]+)/)[1].downcase }
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
30
|
end
|
|
83
31
|
end
|
data/lib/cript/store.rb
CHANGED
|
@@ -17,14 +17,17 @@ module Cript
|
|
|
17
17
|
#
|
|
18
18
|
# passphrase
|
|
19
19
|
# thread_safe
|
|
20
|
-
def initialize(file,
|
|
21
|
-
@
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
thread_safe = !!options.delete(:thread_safe)
|
|
20
|
+
def initialize(file, opts = {})
|
|
21
|
+
@opts = opts
|
|
22
|
+
@cript = Cript::Simple.new(@opts)
|
|
23
|
+
thread_safe = !!@opts.delete(:thread_safe)
|
|
25
24
|
super(file, thread_safe)
|
|
26
25
|
end
|
|
27
26
|
|
|
27
|
+
def self.insecure(file, opts = {})
|
|
28
|
+
new(file, opts.merge({ private_key_content: INSECURE_PRIVATE_KEY }))
|
|
29
|
+
end
|
|
30
|
+
|
|
28
31
|
def inspect
|
|
29
32
|
"#<#{self.class.name} path=#{path}>"
|
|
30
33
|
end
|
|
@@ -35,12 +38,12 @@ module Cript
|
|
|
35
38
|
|
|
36
39
|
# encrypt
|
|
37
40
|
def dump(table)
|
|
38
|
-
@
|
|
41
|
+
@cript.encrypt(Marshal::dump(table))
|
|
39
42
|
end
|
|
40
43
|
|
|
41
44
|
# decrypt
|
|
42
45
|
def load(content)
|
|
43
|
-
Marshal::load(@
|
|
46
|
+
Marshal::load(@cript.decrypt(content))
|
|
44
47
|
end
|
|
45
48
|
|
|
46
49
|
def marshal_dump_supports_canonical_option?
|
data/lib/cript/version.rb
CHANGED
data/spec/ehash_spec.rb
CHANGED
|
@@ -13,7 +13,7 @@ describe Cript::EHash do
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
it 'should encrypt and decrypt' do
|
|
16
|
-
e = Cript::EHash.
|
|
16
|
+
e = Cript::EHash.insecure(file)
|
|
17
17
|
data = 10.times.inject({}) { |data,i| data[SecureRandom.hex] = SecureRandom.random_bytes(4096); data }
|
|
18
18
|
data.keys.each do |key|
|
|
19
19
|
e[key] = data[key]
|
data/spec/naive_spec.rb
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
|
+
require 'cript/naive'
|
|
2
3
|
|
|
3
4
|
describe Cript::Naive do
|
|
4
5
|
let(:naive) do
|
|
5
6
|
Cript::Simple.new({
|
|
6
|
-
private_key_content: Cript::
|
|
7
|
-
public_key_content: Cript::PUBLIC_KEY,
|
|
8
|
-
size: Cript::KEY_SIZE
|
|
7
|
+
private_key_content: Cript::INSECURE_PRIVATE_KEY
|
|
9
8
|
})
|
|
10
9
|
end
|
|
11
10
|
let(:small_data) { SecureRandom.random_bytes }
|
data/spec/simple_spec.rb
CHANGED
|
@@ -3,8 +3,7 @@ require 'spec_helper'
|
|
|
3
3
|
describe Cript::Simple do
|
|
4
4
|
let(:simple) do
|
|
5
5
|
Cript::Simple.new({
|
|
6
|
-
private_key_content: Cript::
|
|
7
|
-
public_key_content: Cript::PUBLIC_KEY
|
|
6
|
+
private_key_content: Cript::INSECURE_PRIVATE_KEY
|
|
8
7
|
})
|
|
9
8
|
end
|
|
10
9
|
let(:small_data) { SecureRandom.random_bytes }
|
metadata
CHANGED
|
@@ -1,62 +1,55 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cript
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 0.0.4
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Andrew Tongen
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 2014-05-30 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: bundler
|
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
16
|
requirements:
|
|
19
|
-
- - ~>
|
|
17
|
+
- - "~>"
|
|
20
18
|
- !ruby/object:Gem::Version
|
|
21
19
|
version: '1.3'
|
|
22
20
|
type: :development
|
|
23
21
|
prerelease: false
|
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
none: false
|
|
26
23
|
requirements:
|
|
27
|
-
- - ~>
|
|
24
|
+
- - "~>"
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
29
26
|
version: '1.3'
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
|
31
28
|
name: rake
|
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
30
|
requirements:
|
|
35
|
-
- -
|
|
31
|
+
- - ">="
|
|
36
32
|
- !ruby/object:Gem::Version
|
|
37
33
|
version: '0'
|
|
38
34
|
type: :development
|
|
39
35
|
prerelease: false
|
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
none: false
|
|
42
37
|
requirements:
|
|
43
|
-
- -
|
|
38
|
+
- - ">="
|
|
44
39
|
- !ruby/object:Gem::Version
|
|
45
40
|
version: '0'
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
|
47
42
|
name: rspec
|
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
none: false
|
|
50
44
|
requirements:
|
|
51
|
-
- -
|
|
45
|
+
- - ">="
|
|
52
46
|
- !ruby/object:Gem::Version
|
|
53
47
|
version: '0'
|
|
54
48
|
type: :development
|
|
55
49
|
prerelease: false
|
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
none: false
|
|
58
51
|
requirements:
|
|
59
|
-
- -
|
|
52
|
+
- - ">="
|
|
60
53
|
- !ruby/object:Gem::Version
|
|
61
54
|
version: '0'
|
|
62
55
|
description: Simple Encryption Tools for Ruby
|
|
@@ -67,9 +60,9 @@ executables:
|
|
|
67
60
|
extensions: []
|
|
68
61
|
extra_rdoc_files: []
|
|
69
62
|
files:
|
|
70
|
-
- .gitignore
|
|
71
|
-
- .rspec
|
|
72
|
-
- .travis.yml
|
|
63
|
+
- ".gitignore"
|
|
64
|
+
- ".rspec"
|
|
65
|
+
- ".travis.yml"
|
|
73
66
|
- Gemfile
|
|
74
67
|
- LICENSE.txt
|
|
75
68
|
- README.md
|
|
@@ -80,6 +73,7 @@ files:
|
|
|
80
73
|
- lib/cript/cript_command.rb
|
|
81
74
|
- lib/cript/cripter.rb
|
|
82
75
|
- lib/cript/ehash.rb
|
|
76
|
+
- lib/cript/key_info.rb
|
|
83
77
|
- lib/cript/naive.rb
|
|
84
78
|
- lib/cript/simple.rb
|
|
85
79
|
- lib/cript/store.rb
|
|
@@ -92,27 +86,26 @@ files:
|
|
|
92
86
|
homepage: https://github.com/atongen/cript
|
|
93
87
|
licenses:
|
|
94
88
|
- MIT
|
|
89
|
+
metadata: {}
|
|
95
90
|
post_install_message:
|
|
96
91
|
rdoc_options: []
|
|
97
92
|
require_paths:
|
|
98
93
|
- lib
|
|
99
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
100
|
-
none: false
|
|
101
95
|
requirements:
|
|
102
|
-
- -
|
|
96
|
+
- - ">="
|
|
103
97
|
- !ruby/object:Gem::Version
|
|
104
98
|
version: '0'
|
|
105
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
|
-
none: false
|
|
107
100
|
requirements:
|
|
108
|
-
- -
|
|
101
|
+
- - ">="
|
|
109
102
|
- !ruby/object:Gem::Version
|
|
110
103
|
version: '0'
|
|
111
104
|
requirements: []
|
|
112
105
|
rubyforge_project:
|
|
113
|
-
rubygems_version:
|
|
106
|
+
rubygems_version: 2.2.2
|
|
114
107
|
signing_key:
|
|
115
|
-
specification_version:
|
|
108
|
+
specification_version: 4
|
|
116
109
|
summary: Simple Encryption Tools for Ruby
|
|
117
110
|
test_files:
|
|
118
111
|
- spec/cript_command_spec.rb
|
|
@@ -120,4 +113,3 @@ test_files:
|
|
|
120
113
|
- spec/naive_spec.rb
|
|
121
114
|
- spec/simple_spec.rb
|
|
122
115
|
- spec/spec_helper.rb
|
|
123
|
-
has_rdoc:
|