mini_ca 0.1.0 → 1.0.0

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: ba8cda5d5c7a9ebbd7baa7803916e988ffc7520c
4
- data.tar.gz: fdee1aafd4a2e43fb1bb4b98dd271cb4a7ef0654
3
+ metadata.gz: 8b5eb806c9785fd8ce55c117dfe4fc4b018b1531
4
+ data.tar.gz: 4ac9e96bdc3d9d03d336cd2d6cee9c0c918b7556
5
5
  SHA512:
6
- metadata.gz: cd647947568fd6e7081284b3b34a4935c10326b95c0dbeddcc439845d76435d14c17b498e773dffb5eeee3fea9481b82ed5d62a08dab6dc932c1516e12f3f98f
7
- data.tar.gz: 7ed91bff6a7617c18415eb5f9e652511f403d1fa2cb897932d26ec94375534d16bebeb78092dca0364cc2c5070b288cee58078ff37b131fc42b5575b98c79ee2
6
+ metadata.gz: 17ec4d452f34a2ef3683886b6613bdd09eb9f90c703e4ac69b9bce1dbd974d009668012a5a148c1121bdbff1893f884ad43f4a8871e4dc1e88a2457fddc12572
7
+ data.tar.gz: b6a79a95f467bbfcd82745e3ca4c5477d2cee1acc55760e6b0e2b63b059f1f64d99042af7a0b4c453ff5cd7c6b2d6eaea13d55cd371d8cd58f6294b9bf4b7d76
@@ -2,7 +2,7 @@ module MiniCa
2
2
  class Certificate
3
3
  DIGEST = OpenSSL::Digest::SHA256
4
4
 
5
- attr_reader :key, :x509, :issuer, :ca
5
+ attr_reader :private_key, :x509, :issuer, :ca
6
6
 
7
7
  # rubocop:disable ParameterLists
8
8
  def initialize(
@@ -18,7 +18,7 @@ module MiniCa
18
18
  location: nil,
19
19
  organization: nil
20
20
  )
21
- @key = OpenSSL::PKey::RSA.new(2048)
21
+ @private_key = OpenSSL::PKey::RSA.new(2048)
22
22
  @x509 = OpenSSL::X509::Certificate.new
23
23
  @issuer = issuer
24
24
  @ca = ca
@@ -27,7 +27,7 @@ module MiniCa
27
27
  x509.version = 0x2
28
28
  x509.serial = serial || 0
29
29
 
30
- x509.public_key = key.public_key
30
+ x509.public_key = private_key.public_key
31
31
 
32
32
  x509.subject = OpenSSL::X509::Name.new
33
33
 
@@ -81,7 +81,7 @@ module MiniCa
81
81
 
82
82
  exts.each { |e| x509.add_extension(e) }
83
83
 
84
- signing_key = issuer ? issuer.key : key
84
+ signing_key = issuer ? issuer.private_key : private_key
85
85
  x509.sign signing_key, DIGEST.new
86
86
  end
87
87
  # rubocop:enable ParameterLists
@@ -122,8 +122,8 @@ module MiniCa
122
122
  bundle.map(&:x509).map(&:to_s).join('')
123
123
  end
124
124
 
125
- def key_pem
126
- key.to_s
125
+ def private_key_pem
126
+ private_key.to_s
127
127
  end
128
128
  end
129
129
  end
@@ -1,3 +1,3 @@
1
1
  module MiniCa
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '1.0.0'.freeze
3
3
  end
@@ -130,4 +130,11 @@ describe MiniCa::Certificate do
130
130
  expect(c.bundle_pem).to end_with(i1.x509_pem)
131
131
  end
132
132
  end
133
+
134
+ describe '#private_key_pem' do
135
+ it 'returns a private key' do
136
+ c = described_class.new('foo')
137
+ expect(c.private_key_pem).to include('BEGIN RSA PRIVATE KEY')
138
+ end
139
+ end
133
140
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_ca
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Orozco