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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02a530752f0bb7d45a71a7e5b5c63a48c82ba866
4
- data.tar.gz: 04ff0c5fccc77cefde01ff9d3e932e270d8bde02
3
+ metadata.gz: 67c134961045b411bbf42e1d0a1a7eec1c583689
4
+ data.tar.gz: 158b1e938a56937f814d51905fb1b0c2ad39ec91
5
5
  SHA512:
6
- metadata.gz: 2368c9dcad07fc216d00d046f5259cb9fcca43000347d5b286ad558d190b6eefcf2f4092da28daaebe52748ee9e0b723ee910655735a7d3f0f887fb5d77b2257
7
- data.tar.gz: ba14d2d8a428d11406156136c19b4d4779a696e90c9bf1284f8e4f1a9054c6bfff45e18c6da1f2605b993efae9de52104119baca9a335929784ef2af6322f317
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
@@ -6,5 +6,5 @@ require 'signed_config/reader'
6
6
  require 'signed_config/writer'
7
7
 
8
8
  module SignedConfig
9
- VERSION = "0.0.2"
9
+ VERSION = "0.0.3"
10
10
  end
@@ -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.2
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-07 00:00:00.000000000 Z
11
+ date: 2015-12-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: