Class: Bosh::Ssl::Certificate
- Inherits:
-
Object
- Object
- Bosh::Ssl::Certificate
show all
- Defined in:
- lib/common/ssl.rb
Defined Under Namespace
Classes: MatchingFileNotFound, SubjectsDoNotMatchException
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(key_path, certificate_path, common_name, chain_path = nil) ⇒ Certificate
13
14
15
16
17
18
|
# File 'lib/common/ssl.rb', line 13
def initialize(key_path, certificate_path, common_name, chain_path = nil)
@key_path = key_path
@certificate_path = certificate_path
@chain_path = chain_path
@subject_string = subject_string(common_name)
end
|
Instance Attribute Details
#certificate_path ⇒ Object
Returns the value of attribute certificate_path.
11
12
13
|
# File 'lib/common/ssl.rb', line 11
def certificate_path
@certificate_path
end
|
#key_path ⇒ Object
Returns the value of attribute key_path.
11
12
13
|
# File 'lib/common/ssl.rb', line 11
def key_path
@key_path
end
|
Instance Method Details
#certificate ⇒ Object
24
25
26
|
# File 'lib/common/ssl.rb', line 24
def certificate
@csr_cert.to_pem
end
|
#chain ⇒ Object
28
29
30
|
# File 'lib/common/ssl.rb', line 28
def chain
@chain.to_pem if @chain
end
|
#key ⇒ Object
20
21
22
|
# File 'lib/common/ssl.rb', line 20
def key
@key.to_pem
end
|
#load_or_create ⇒ Object
32
33
34
35
36
37
|
# File 'lib/common/ssl.rb', line 32
def load_or_create
@key, @csr_cert = load_or_create_key_and_csr_cert
@chain = OpenSSL::X509::Certificate.new(File.read(@chain_path)) if @chain_path
self
end
|