Class: Ritm::CA
Overview
Wrapper on a Certificate Authority with ability of signing certificates
Instance Attribute Summary
Attributes inherited from Certificate
#cert
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Certificate
#initialize, #pem, #private_key, #public_key
Class Method Details
.create(common_name: 'RubyInTheMiddle') ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/ritm/certs/ca.rb', line 7
def self.create(common_name: 'RubyInTheMiddle')
super(common_name, serial_number: 1) do |cert|
cert.signing_entity = true
cert.sign!(signing_profile)
yield cert if block_given?
end
end
|
.load(crt, private_key) ⇒ Object
15
16
17
18
19
20
21
|
# File 'lib/ritm/certs/ca.rb', line 15
def self.load(crt, private_key)
super(crt, private_key) do |cert|
cert.signing_entity = true
cert.sign!(signing_profile)
yield cert if block_given?
end
end
|
.signing_profile ⇒ Object
28
29
30
|
# File 'lib/ritm/certs/ca.rb', line 28
def self.signing_profile
{ 'extensions' => { 'keyUsage' => { 'usage' => %w(critical keyCertSign keyEncipherment digitalSignature) } } }
end
|
Instance Method Details
#sign(certificate) ⇒ Object
23
24
25
26
|
# File 'lib/ritm/certs/ca.rb', line 23
def sign(certificate)
certificate.cert.parent = @cert
certificate.cert.sign!
end
|