Class: ZATCA::Signing::Certificate
- Inherits:
-
Object
- Object
- ZATCA::Signing::Certificate
- Defined in:
- lib/zatca/signing/certificate.rb
Instance Attribute Summary collapse
-
#cert_content_without_headers ⇒ Object
Returns the value of attribute cert_content_without_headers.
-
#hash ⇒ Object
Returns the value of attribute hash.
-
#issuer_name ⇒ Object
Returns the value of attribute issuer_name.
-
#public_key ⇒ Object
Returns the value of attribute public_key.
-
#public_key_bytes ⇒ Object
Returns the value of attribute public_key_bytes.
-
#public_key_without_headers ⇒ Object
Returns the value of attribute public_key_without_headers.
-
#serial_number ⇒ Object
Returns the value of attribute serial_number.
-
#signature ⇒ Object
Returns the value of attribute signature.
Class Method Summary collapse
-
.generate_base64_hash(base64_certificate) ⇒ Object
Returns the certificate hashed with SHA256 then Base64 encoded.
- .read_certificate(certificate_path) ⇒ Object
Instance Method Summary collapse
-
#initialize(openssl_certificate:) ⇒ Certificate
constructor
A new instance of Certificate.
Constructor Details
#initialize(openssl_certificate:) ⇒ Certificate
Returns a new instance of Certificate.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/zatca/signing/certificate.rb', line 17 def initialize(openssl_certificate:) super() @serial_number = nil @issuer_name = nil @cert_content_without_headers = nil @hash = nil @public_key = nil @public_key_without_headers = nil @public_key_bytes = nil @signature = nil @openssl_certificate = openssl_certificate parse_certificate end |
Instance Attribute Details
#cert_content_without_headers ⇒ Object
Returns the value of attribute cert_content_without_headers.
2 3 4 |
# File 'lib/zatca/signing/certificate.rb', line 2 def cert_content_without_headers @cert_content_without_headers end |
#hash ⇒ Object
Returns the value of attribute hash.
2 3 4 |
# File 'lib/zatca/signing/certificate.rb', line 2 def hash @hash end |
#issuer_name ⇒ Object
Returns the value of attribute issuer_name.
2 3 4 |
# File 'lib/zatca/signing/certificate.rb', line 2 def issuer_name @issuer_name end |
#public_key ⇒ Object
Returns the value of attribute public_key.
2 3 4 |
# File 'lib/zatca/signing/certificate.rb', line 2 def public_key @public_key end |
#public_key_bytes ⇒ Object
Returns the value of attribute public_key_bytes.
2 3 4 |
# File 'lib/zatca/signing/certificate.rb', line 2 def public_key_bytes @public_key_bytes end |
#public_key_without_headers ⇒ Object
Returns the value of attribute public_key_without_headers.
2 3 4 |
# File 'lib/zatca/signing/certificate.rb', line 2 def public_key_without_headers @public_key_without_headers end |
#serial_number ⇒ Object
Returns the value of attribute serial_number.
2 3 4 |
# File 'lib/zatca/signing/certificate.rb', line 2 def serial_number @serial_number end |
#signature ⇒ Object
Returns the value of attribute signature.
2 3 4 |
# File 'lib/zatca/signing/certificate.rb', line 2 def signature @signature end |
Class Method Details
.generate_base64_hash(base64_certificate) ⇒ Object
Returns the certificate hashed with SHA256 then Base64 encoded
7 8 9 |
# File 'lib/zatca/signing/certificate.rb', line 7 def self.generate_base64_hash(base64_certificate) ZATCA::Hashing.generate_hashes(base64_certificate)[:hexdigest_base64] end |
.read_certificate(certificate_path) ⇒ Object
11 12 13 14 15 |
# File 'lib/zatca/signing/certificate.rb', line 11 def self.read_certificate(certificate_path) certificate = OpenSSL::X509::Certificate.new(File.read(certificate_path)) new(openssl_certificate: certificate) end |