easyrsa 0.9.1 → 0.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24a09b13312931ca57653b0a7329b2a12ceca314
4
- data.tar.gz: 9698fee089060bdb3573c2673b237960ae650187
3
+ metadata.gz: 5867f7b266b3dc21da5099fc19bc412d55038e9d
4
+ data.tar.gz: 9c51aff5109ee8160b3b4a876bb553b1c979a275
5
5
  SHA512:
6
- metadata.gz: 9f93737435287cae5065f7b3d497e36a37e09f1ab7e5886ed4d17119ec7d29f3833f7f2d732e6a0ff6a6229bdcc328e97ba4c0cac1edbe3f4a29c0483a12a847
7
- data.tar.gz: 59547ffbf6d306bc9184454bfe8fea06afd90e30b0c567c0a1f6bc715ddd49088cd0065f38000f8367c1c5b96afe56ff95e599a954d3e91ba2c1b8d122de10f1
6
+ metadata.gz: d3a47654d291560264b4d886a2ba9219fc81ca05847c517ee1230f1391d17c23795a21e43f15bdfbc854d9f7d38dd0525b0dc0f717af9a7f8ace95b301d6cadd
7
+ data.tar.gz: 55053569d0743c54832d75ef61a862b3a6cacca2caf7b933d55322a4f197e53bf91cb196b290359130fb793152bf2a87d956b2a42bb2c356914991587e20ded6
@@ -6,6 +6,7 @@ require 'easyrsa/certificate'
6
6
  require 'easyrsa/ca'
7
7
  #require 'easyrsa/cli'
8
8
  require 'easyrsa/revoke'
9
+ require 'easyrsa/dh'
9
10
 
10
11
  module EasyRSA
11
12
 
@@ -0,0 +1,27 @@
1
+ require 'paint'
2
+
3
+ module EasyRSA
4
+ module CLI
5
+
6
+ def self.success(message)
7
+ puts " #{Paint['[✓]', :bright, :green]} #{Paint[message, :bright, :white]}"
8
+ exit!
9
+ end
10
+
11
+ def self.info(message)
12
+ puts " #{Paint['[i]', :bright, :blue]} #{Paint[message, :bright, :white]}"
13
+ exit!
14
+ end
15
+
16
+ def self.warning(message)
17
+ puts " #{Paint['[!]', :bright, :orange]} #{Paint[message, :bright, :white]}"
18
+ exit!
19
+ end
20
+
21
+ def self.fatal(message)
22
+ puts " #{Paint['[x]', :bright, :red]} #{Paint[message, :bright, :white]}"
23
+ exit!
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,24 @@
1
+ module EasyRSA
2
+ class DH
3
+
4
+ class BitLengthToWeak < RuntimeError; end
5
+ class MissingParameter < RuntimeError; end
6
+
7
+ def initialize(bits=1024, &block)
8
+ # Generate DH
9
+ if bits < 1024
10
+ raise EasyRSA::DH::BitLengthToWeak,
11
+ "Please select a bit length greater than 2048. Default is 4096. You chose '#{bits}'"
12
+ end
13
+ @dh = OpenSSL::PKey::DH.new(bits)
14
+
15
+ instance_eval(&block) if block_given?
16
+ end
17
+
18
+ def generate
19
+ dh = @dh.generate_key!
20
+ dh.to_pem
21
+ end
22
+
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module EasyRSA
2
- VERSION = '0.9.1'
2
+ VERSION = '0.9.2'
3
3
  end
@@ -0,0 +1,23 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'spec_helper')
2
+
3
+ describe EasyRSA::DH, 'Should' do
4
+
5
+ it 'should not throw error when calling new' do
6
+ expect {
7
+ EasyRSA::DH.new
8
+ }.to_not raise_error
9
+ end
10
+
11
+ it 'throw error when bit length is too weak' do
12
+ expect {
13
+ EasyRSA::DH.new 512
14
+ }.to raise_error(EasyRSA::DH::BitLengthToWeak)
15
+ end
16
+
17
+ it 'should export a real dh param' do
18
+ dh = EasyRSA::DH.new
19
+ output = dh.generate
20
+ expect(output).to include('BEGIN DH PARAMETERS')
21
+ end
22
+
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easyrsa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Mackintosh
@@ -111,7 +111,9 @@ files:
111
111
  - lib/easyrsa.rb
112
112
  - lib/easyrsa/ca.rb
113
113
  - lib/easyrsa/certificate.rb
114
+ - lib/easyrsa/cli.rb
114
115
  - lib/easyrsa/config.rb
116
+ - lib/easyrsa/dh.rb
115
117
  - lib/easyrsa/revoke.rb
116
118
  - lib/easyrsa/version.rb
117
119
  - spec/cacert.pem
@@ -120,6 +122,7 @@ files:
120
122
  - spec/easyrsa/02_certificate_spec.rb
121
123
  - spec/easyrsa/03_ca_spec.rb
122
124
  - spec/easyrsa/04_revocation_spec.rb
125
+ - spec/easyrsa/05_dh_spec.rb
123
126
  - spec/spec_helper.rb
124
127
  homepage: http://github.com/mikemackintosh/ruby-easyrsa
125
128
  licenses:
@@ -152,4 +155,5 @@ test_files:
152
155
  - spec/easyrsa/02_certificate_spec.rb
153
156
  - spec/easyrsa/03_ca_spec.rb
154
157
  - spec/easyrsa/04_revocation_spec.rb
158
+ - spec/easyrsa/05_dh_spec.rb
155
159
  - spec/spec_helper.rb