Module: R509::OIDMapper

Defined in:
lib/r509/oid_mapper.rb

Overview

Helps map raw OIDs to friendlier short names

Class Method Summary (collapse)

Class Method Details

+ (Object) batch_register(oids)

Register a batch of OIDs so we have friendly short names ]

Examples:

R509::OIDMapper.batch_register([
 {:oid => "1.2.3.4.5", :short_name => "sName", :long_name => "lName"},
 {:oid => "1.2.3.4.6", :short_name => "oName"}

Parameters:

  • oids (Array)

    An array of hashes



25
26
27
28
29
30
# File 'lib/r509/oid_mapper.rb', line 25

def self.batch_register(oids)
  oids.each do |oid_hash|
    self.register(oid_hash[:oid],oid_hash[:short_name],oid_hash[:long_name])
  end
  nil
end

+ (Boolean) register(oid, short_name, long_name = nil)

Register an OID so we have a friendly short name

Parameters:

  • oid (String)

    A string representation of the OID you want to map (e.g. "1.6.2.3.55")

  • short_name (String)

    The short name (e.g. CN, O, OU, emailAddress)

  • long_name (String) (defaults to: nil)

    Optional long name. Defaults to the same as short_name

Returns:

  • (Boolean)

    success/failure



11
12
13
14
15
16
# File 'lib/r509/oid_mapper.rb', line 11

def self.register(oid,short_name,long_name=nil)
  if long_name.nil?
    long_name = short_name
  end
  OpenSSL::ASN1::ObjectId.register(oid, short_name, long_name)
end