Class: Akami::WSSE::Certs
- Inherits:
-
Object
- Object
- Akami::WSSE::Certs
- Defined in:
- lib/akami/wsse/certs.rb
Overview
Contains certs for WSSE::Signature
Instance Attribute Summary collapse
-
#cert_file ⇒ Object
Returns the value of attribute cert_file.
-
#cert_string ⇒ Object
Returns the value of attribute cert_string.
-
#private_key_file ⇒ Object
Returns the value of attribute private_key_file.
-
#private_key_password ⇒ Object
Returns the value of attribute private_key_password.
-
#private_key_string ⇒ Object
Returns the value of attribute private_key_string.
Instance Method Summary collapse
-
#cert ⇒ Object
Returns an
OpenSSL::X509::Certificate
for thecert_string
orcert_file
. -
#initialize(certs = {}) ⇒ Certs
constructor
A new instance of Certs.
-
#private_key ⇒ Object
Returns an
OpenSSL::PKey::RSA
for theprivate_key_string
orprivate_key_file
.
Constructor Details
#initialize(certs = {}) ⇒ Certs
Returns a new instance of Certs.
6 7 8 9 10 |
# File 'lib/akami/wsse/certs.rb', line 6 def initialize(certs = {}) certs.each do |key, value| self.send :"#{key}=", value end end |
Instance Attribute Details
#cert_file ⇒ Object
Returns the value of attribute cert_file.
12 13 14 |
# File 'lib/akami/wsse/certs.rb', line 12 def cert_file @cert_file end |
#cert_string ⇒ Object
Returns the value of attribute cert_string.
12 13 14 |
# File 'lib/akami/wsse/certs.rb', line 12 def cert_string @cert_string end |
#private_key_file ⇒ Object
Returns the value of attribute private_key_file.
12 13 14 |
# File 'lib/akami/wsse/certs.rb', line 12 def private_key_file @private_key_file end |
#private_key_password ⇒ Object
Returns the value of attribute private_key_password.
12 13 14 |
# File 'lib/akami/wsse/certs.rb', line 12 def private_key_password @private_key_password end |
#private_key_string ⇒ Object
Returns the value of attribute private_key_string.
12 13 14 |
# File 'lib/akami/wsse/certs.rb', line 12 def private_key_string @private_key_string end |
Instance Method Details
#cert ⇒ Object
Returns an OpenSSL::X509::Certificate
for the cert_string
or cert_file
.
15 16 17 18 19 20 21 22 |
# File 'lib/akami/wsse/certs.rb', line 15 def cert @cert ||= if !cert_string.nil? OpenSSL::X509::Certificate.new(cert_string) elsif !cert_file.nil? OpenSSL::X509::Certificate.new(File.read(cert_file)) end end |
#private_key ⇒ Object
Returns an OpenSSL::PKey::RSA
for the private_key_string
or private_key_file
.
25 26 27 28 29 30 31 32 |
# File 'lib/akami/wsse/certs.rb', line 25 def private_key @private_key ||= if !private_key_string.nil? OpenSSL::PKey::RSA.new(private_key_string, private_key_password) elsif !private_key_file.nil? OpenSSL::PKey::RSA.new(File.read(private_key_file), private_key_password) end end |