Class: OpenSSL::X509::Extension

Inherits:
Object
  • Object
show all
Includes:
Marshal
Defined in:
lib/openssl/x509.rb

Overview

class ExtensionFactory

def create_extension(*arg)
  if arg.size > 1
    create_ext(*arg)
  else
    send("create_ext_from_"+arg[0].class.name.downcase, arg[0])
  end
end

def create_ext_from_array(ary)
  raise ExtensionError, "unexpected array form" if ary.size > 3
  create_ext(ary[0], ary[1], ary[2])
end

def create_ext_from_string(str) # "oid = critical, value"
  oid, value = str.split(/=/, 2)
  oid.strip!
  value.strip!
  create_ext(oid, value)
end

def create_ext_from_hash(hash)
  create_ext(hash["oid"], hash["value"], hash["critical"])
end

end

Defined Under Namespace

Modules: AuthorityInfoAccess, AuthorityKeyIdentifier, CRLDistributionPoints, Helpers, SubjectKeyIdentifier

Instance Method Summary collapse

Methods included from Marshal

#_dump, included

Instance Method Details

#==(other) ⇒ Object



48
49
50
51
# File 'lib/openssl/x509.rb', line 48

def ==(other)
  return false unless Extension === other
  to_der == other.to_der
end

#to_aObject



64
65
66
# File 'lib/openssl/x509.rb', line 64

def to_a
  [ self.oid, self.value, self.critical? ]
end

#to_hObject

“value”=>value, “critical”=>true|false



60
61
62
# File 'lib/openssl/x509.rb', line 60

def to_h # {"oid"=>sn|ln, "value"=>value, "critical"=>true|false}
  {"oid"=>self.oid,"value"=>self.value,"critical"=>self.critical?}
end

#to_sObject

“oid = critical, value”



53
54
55
56
57
58
# File 'lib/openssl/x509.rb', line 53

def to_s # "oid = critical, value"
  str = self.oid
  str << " = "
  str << "critical, " if self.critical?
  str << self.value.gsub(/\n/, ", ")
end