Sha256: 9b4e05a64dc91026494d2eaa229bb4acba5301356c9933122ae828854318ec6c

Contents?: true

Size: 1002 Bytes

Versions: 3

Compression:

Stored size: 1002 Bytes

Contents

# frozen_string_literal: true
module RubyScep
  class PkiMessage
    class Degenerate

      def initialize(certificate)
        @certificate = certificate
      end

      def to_der
        OpenSSL::ASN1::Sequence.new(
          [
            OpenSSL::ASN1::ObjectId.new(OID_SIGNED_DATA),
            OpenSSL::ASN1::ASN1Data.new(
              [
                OpenSSL::ASN1::Sequence.new(
                  [
                    OpenSSL::ASN1::Integer.new(1),
                    OpenSSL::ASN1::Set.new([]),
                    OpenSSL::ASN1::Sequence.new([OpenSSL::ASN1::ObjectId.new(OID_DATA)]),
                    OpenSSL::ASN1::ASN1Data.new([OpenSSL::ASN1::decode(@certificate.to_der)], 0, :CONTEXT_SPECIFIC),
                    OpenSSL::ASN1::ASN1Data.new([], 1, :CONTEXT_SPECIFIC),
                    OpenSSL::ASN1::Set.new([])
                  ]
                )
              ],
              0,
              :CONTEXT_SPECIFIC)
          ]
        ).to_der
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby_scep-0.2.1 lib/ruby_scep/pki_message/degenerate.rb
ruby_scep-0.2.0 lib/ruby_scep/pki_message/degenerate.rb
ruby_scep-0.1.0 lib/ruby_scep/pki_message/degenerate.rb