Module: R509::OIDMapper
- Defined in:
- lib/r509/oid_mapper.rb
Overview
Helps map raw OIDs to friendlier short names
Class Method Summary collapse
-
.batch_register(oids) ⇒ Object
Register a batch of OIDs so we have friendly short names ].
-
.register(oid, short_name, long_name = nil) ⇒ Boolean
Register an OID so we have a friendly short name.
-
.register_from_yaml(name, yaml_data) ⇒ Object
Load YAML and register OIDs.
Class Method Details
.batch_register(oids) ⇒ Object
Register a batch of OIDs so we have friendly short names ]
30 31 32 33 34 35 |
# File 'lib/r509/oid_mapper.rb', line 30 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 |
.register(oid, short_name, long_name = nil) ⇒ Boolean
Register an OID so we have a friendly short name
11 12 13 14 15 16 17 18 19 20 21 |
# 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 begin OpenSSL::ASN1::ObjectId.register(oid, short_name, long_name) rescue OpenSSL::ASN1::ASN1Error false end end |
.register_from_yaml(name, yaml_data) ⇒ Object
Load YAML and register OIDs
46 47 48 49 |
# File 'lib/r509/oid_mapper.rb', line 46 def self.register_from_yaml(name, yaml_data) conf = YAML.load(yaml_data) self.batch_register(conf[name]) end |