Class: OpenSSL::X509::ExtensionFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/1.8/openssl/x509-internal.rb,
lib/1.9/openssl/x509-internal.rb

Instance Method Summary collapse

Instance Method Details

#create_ext_from_array(ary) ⇒ Object

Raises:

  • (ExtensionError)


28
29
30
31
# File 'lib/1.8/openssl/x509-internal.rb', line 28

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

#create_ext_from_hash(hash) ⇒ Object



40
41
42
# File 'lib/1.8/openssl/x509-internal.rb', line 40

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

#create_ext_from_string(str) ⇒ Object

“oid = critical, value”



33
34
35
36
37
38
# File 'lib/1.8/openssl/x509-internal.rb', line 33

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

#create_extension(*arg) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/1.8/openssl/x509-internal.rb', line 20

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