Class: Sigstore::Internal::X509::Extension::PrecertificateSignedCertificateTimestamps

Inherits:
Sigstore::Internal::X509::Extension show all
Defined in:
lib/sigstore/internal/x509.rb

Constant Summary collapse

Timestamp =

rubocop:disable Naming/ConstantName

defined?(Data.define) ? Data.define(*args) : Struct.new(*args, keyword_init: true)
HASHES =
{
  0 => "none",
  1 => "md5",
  2 => "sha1",
  3 => "sha224",
  4 => "sha256",
  5 => "sha384",
  6 => "sha512",
  255 => "unknown"
}.freeze
SIGNATURE_ALGORITHMS =
{
  0 => "anonymous",
  1 => "rsa",
  2 => "dsa",
  3 => "ecdsa",
  255 => "unknown"
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Sigstore::Internal::X509::Extension

#critical?, #initialize, #shift_bitstring, #shift_value

Constructor Details

This class inherits a constructor from Sigstore::Internal::X509::Extension

Instance Attribute Details

#signed_certificate_timestampsObject (readonly)

Returns the value of attribute signed_certificate_timestamps.



405
406
407
# File 'lib/sigstore/internal/x509.rb', line 405

def signed_certificate_timestamps
  @signed_certificate_timestamps
end

Instance Method Details

#parse_value(value) ⇒ Object



407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'lib/sigstore/internal/x509.rb', line 407

def parse_value(value)
  unless value.is_a?(OpenSSL::ASN1::OctetString)
    raise ArgumentError,
          "Invalid SCT extension: #{value.inspect}"
  end

  value = value.value
  length = value.unpack1("n")
  value = value.byteslice(2, length)

  unless value && value.bytesize == length
    raise Error::InvalidCertificate,
          "decoding #{self.class.oid} extension"
  end

  length = value.unpack1("n")
  value = value.byteslice(2, length)

  unless value && value.bytesize == length
    raise Error::InvalidCertificate,
          "decoding #{self.class.oid} extension"
  end

  @signed_certificate_timestamps = unpack_sct_list(value)
end