cryptosystem 0.0.1 → 0.0.2
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.md +3 -0
- data/README.md +12 -0
- data/lib/cryptosystem/rsa.rb +4 -4
- data/lib/cryptosystem/version.rb +1 -1
- data/test/cryptosystem/rsa_test.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbdf320cd42c830082a2bca1375b73004bf92959
|
4
|
+
data.tar.gz: 0db0d1bcce0cf3f9aed1674184083b3eb48fb219
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e68f62f02df25218c7830bd2c6d4d7fbf0260945e4bba0af746e8afdd2ce54555e645f3bd682c8258a5a1969c63837d64a1172508bb7890a1def388e45334d8
|
7
|
+
data.tar.gz: 634bcf5ed8dc0bc81e5d8f8a74ecf4f78482f83dcbb746552a54856bbe620890267145963cb535d85ee06cc6fb9ee153864c041bbcf53a810f7e790e3e2e1996
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -33,6 +33,18 @@ Cryptosystem::RSA.configure do |config|
|
|
33
33
|
end
|
34
34
|
```
|
35
35
|
|
36
|
+
Configuration options may also be passed in or overridden when instantiating a new object.
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
config = {
|
40
|
+
password: ENV['secret-password'],
|
41
|
+
private_key_path: 'path/to/private.key',
|
42
|
+
public_key_path: 'path/to/public.pub'
|
43
|
+
}
|
44
|
+
|
45
|
+
rsa = Cryptosystem::RSA.new(config)
|
46
|
+
```
|
47
|
+
|
36
48
|
## Encrypting
|
37
49
|
After generating a key pair and properly configuring Cryptosystem, encryption is straightforward.
|
38
50
|
|
data/lib/cryptosystem/rsa.rb
CHANGED
@@ -10,10 +10,10 @@ module Cryptosystem
|
|
10
10
|
attr_reader :private_key_path
|
11
11
|
attr_reader :public_key_path
|
12
12
|
|
13
|
-
def initialize
|
14
|
-
@password = Cryptosystem::RSA.password
|
15
|
-
@private_key_path = expand_path(Cryptosystem::RSA.private_key_path)
|
16
|
-
@public_key_path = expand_path(Cryptosystem::RSA.public_key_path)
|
13
|
+
def initialize(config = {})
|
14
|
+
@password = config[:password] || Cryptosystem::RSA.password
|
15
|
+
@private_key_path = expand_path(config[:private_key_path] || Cryptosystem::RSA.private_key_path)
|
16
|
+
@public_key_path = expand_path(config[:public_key_path] || Cryptosystem::RSA.public_key_path)
|
17
17
|
rescue => error
|
18
18
|
raise ConfigurationError, error.message
|
19
19
|
end
|
data/lib/cryptosystem/version.rb
CHANGED
@@ -6,6 +6,17 @@ class RSATest < Minitest::Test
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def test_initialize
|
9
|
+
config = {
|
10
|
+
password: 'override',
|
11
|
+
private_key_path: 'override.key',
|
12
|
+
public_key_path: 'override.pub'
|
13
|
+
}
|
14
|
+
|
15
|
+
rsa = Cryptosystem::RSA.new(config)
|
16
|
+
assert_equal config[:password], rsa.password
|
17
|
+
assert_equal File.expand_path(config[:private_key_path]), rsa.private_key_path
|
18
|
+
assert_equal File.expand_path(config[:public_key_path]), rsa.public_key_path
|
19
|
+
|
9
20
|
assert_equal Cryptosystem::RSA.password, @rsa.password
|
10
21
|
assert_equal File.expand_path(@rsa.private_key_path), @rsa.private_key_path
|
11
22
|
assert_equal File.expand_path(@rsa.public_key_path), @rsa.public_key_path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cryptosystem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Wetzel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
Cryptosystem is a Ruby library facilitating simple encryption and
|