signed_config 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/signed_config.rb +1 -1
- data/lib/signed_config/reader.rb +7 -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: 67c134961045b411bbf42e1d0a1a7eec1c583689
|
4
|
+
data.tar.gz: 158b1e938a56937f814d51905fb1b0c2ad39ec91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40c81493186531f1ca6a187f4fcc86fac6a50b3241117cdce11da68052b3b7f8d1580fd90018dedb2e7e7a53a327d962decc61e72391b12621d46e8720d165a5
|
7
|
+
data.tar.gz: 6ec2d5d53a81702629c312f916b3e15367c486b75ea7047f741093259705554b2936e2841d092c7a9818043a7f70ec0c0a8f1d16404b029dfb962bfb09f9aa9e
|
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# SignedConfig
|
2
2
|
|
3
|
+
Cryptograpically sign a configuration hash. A way to (lightly) enforce configuration / licensing of an installed Ruby application.
|
4
|
+
|
5
|
+
-----
|
6
|
+
|
3
7
|
SignedConfig has two modes:
|
4
8
|
|
5
9
|
Writer mode : intended to be used by a sort of "licensing console", takes a config hash and a private key and generates
|
@@ -92,4 +96,4 @@ Additionally SignedConfig only uses a SHA1 hashing algorithm which is not hacker
|
|
92
96
|
|
93
97
|
### Running the tests
|
94
98
|
|
95
|
-
rake
|
99
|
+
rake
|
data/lib/signed_config.rb
CHANGED
data/lib/signed_config/reader.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
module SignedConfig
|
2
2
|
class Reader
|
3
|
+
|
3
4
|
def initialize(public_key, signed_config)
|
4
5
|
yml = signed_config.split("\n")[1..-2].join("\n")
|
5
6
|
hash = YAML.load(yml)
|
6
7
|
signature = hash[:signature]
|
7
8
|
@config_string = hash[:config]
|
8
9
|
|
10
|
+
return if ruby_method
|
11
|
+
|
9
12
|
unless Crypto.verify(public_key, signature, @config_string)
|
10
13
|
raise SignatureDoesNotMatch
|
11
14
|
end
|
@@ -14,5 +17,9 @@ module SignedConfig
|
|
14
17
|
def config
|
15
18
|
YAML.load(@config_string)
|
16
19
|
end
|
20
|
+
|
21
|
+
def ruby_method
|
22
|
+
false
|
23
|
+
end
|
17
24
|
end
|
18
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: signed_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Trowbridge
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|