easyrsa 0.8.9 → 0.9.0
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/lib/easyrsa/revoke.rb +9 -5
- data/lib/easyrsa/version.rb +1 -1
- data/spec/easyrsa/01_config_spec.rb +16 -2
- data/spec/easyrsa/04_revocation_spec.rb +11 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4f50650da31006752f7576b6a88f5dfc81bad51
|
4
|
+
data.tar.gz: 3bf1c9fcc5a2990421bba0d946ef27362966a8d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56d791565ebcf487aaedd3c60c28e568b5f306b71ed21987cb87e210d232f39061be0093d1a32222c1d4f8750be55aa57bc006b3e4309d8619b8274853686fd2
|
7
|
+
data.tar.gz: ce70a1553c80fb0b8bcbb35cb4d6b16667206d3c075ae2dc4facdce2f6d40ca80394278d895e31f6d4464a3973f09dd31d7b529e7fe4ff3938aed30ef89df3c8
|
data/lib/easyrsa/revoke.rb
CHANGED
@@ -40,11 +40,15 @@ module EasyRSA
|
|
40
40
|
|
41
41
|
# Get cert details if it's in a file
|
42
42
|
unless cakey.is_a? OpenSSL::PKey::RSA
|
43
|
-
|
44
|
-
cakey = OpenSSL::PKey::RSA.new
|
45
|
-
|
46
|
-
|
47
|
-
|
43
|
+
if cakey.include?('BEGIN RSA PRIVATE KEY')
|
44
|
+
cakey = OpenSSL::PKey::RSA.new cakey
|
45
|
+
else
|
46
|
+
begin
|
47
|
+
cakey = OpenSSL::PKey::RSA.new File.read cakey
|
48
|
+
rescue OpenSSL::PKey::RSAError => e
|
49
|
+
fail EasyRSA::Revoke::InvalidCARootPrivateKey,
|
50
|
+
'This is not a valid Private key file.'
|
51
|
+
end
|
48
52
|
end
|
49
53
|
end
|
50
54
|
|
data/lib/easyrsa/version.rb
CHANGED
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
|
3
3
|
describe EasyRSA::Config, 'Should' do
|
4
4
|
include_context "shared environment"
|
5
5
|
|
6
|
-
it 'throw error when missing required configure parameters' do
|
6
|
+
it 'should throw error when missing required configure parameters' do
|
7
7
|
|
8
8
|
expect {
|
9
9
|
EasyRSA.configure do |issuer|
|
@@ -17,7 +17,7 @@ describe EasyRSA::Config, 'Should' do
|
|
17
17
|
|
18
18
|
end
|
19
19
|
|
20
|
-
it 'configure correctly' do
|
20
|
+
it 'should configure correctly in block format' do
|
21
21
|
|
22
22
|
expect {
|
23
23
|
EasyRSA.configure do |issuer|
|
@@ -32,4 +32,18 @@ describe EasyRSA::Config, 'Should' do
|
|
32
32
|
|
33
33
|
end
|
34
34
|
|
35
|
+
it 'should configure correctly when in hash form' do
|
36
|
+
|
37
|
+
expect {
|
38
|
+
config = { email: @email,
|
39
|
+
server: @server,
|
40
|
+
country: @country,
|
41
|
+
city: @city,
|
42
|
+
company: @company,
|
43
|
+
orgunit: @orgunit }
|
44
|
+
EasyRSA::Config.from_hash config
|
45
|
+
}.not_to raise_error
|
46
|
+
|
47
|
+
end
|
48
|
+
|
35
49
|
end
|
@@ -98,4 +98,15 @@ CERT
|
|
98
98
|
expect(existing_crl).to_not eql(crl.to_pem)
|
99
99
|
end
|
100
100
|
|
101
|
+
it 'should successfully revoke with key in OpenSSL::PKey::RSA format' do
|
102
|
+
|
103
|
+
easyrsa = EasyRSA::Certificate.new(@ca_cert, @ca_key, 'mike', 'mike@ruby-easyrsa.gem')
|
104
|
+
g = easyrsa.generate
|
105
|
+
|
106
|
+
r = EasyRSA::Revoke.new g[:crt]
|
107
|
+
crl = r.revoke! OpenSSL::PKey::RSA.new File.read @ca_key
|
108
|
+
|
109
|
+
expect(crl.to_pem).to include('BEGIN X509 CRL')
|
110
|
+
end
|
111
|
+
|
101
112
|
end
|