Class: R509::ASN1::GeneralNames

Inherits:
Object
  • Object
show all
Defined in:
lib/r509/asn1.rb

Overview

object to hold parsed sequences of generalnames these structures are used in SubjectAlternativeName, AuthorityInfoAccess, CRLDistributionPoints, etc

Instance Method Summary (collapse)

Constructor Details

- (GeneralNames) initialize

A new instance of GeneralNames



206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/r509/asn1.rb', line 206

def initialize
  @types = {
    :otherName => [], # unimplemented
    :rfc822Name => [],
    :dNSName => [],
    :x400Address => [], # unimplemented
    :directoryName => [],
    :ediPartyName => [], # unimplemented
    :uniformResourceIdentifier => [],
    :iPAddress => [],
    :registeredID => [] # unimplemented
  }
  @ordered_names = []
end

Instance Method Details

- (Array) directory_names

Array of directoryNames (R509::Subject objects)

Returns:

  • (Array)

    Array of directoryNames (R509::Subject objects)



277
278
279
# File 'lib/r509/asn1.rb', line 277

def directory_names
  @types[:directoryName]
end

- (Array) dns_names

Array of dnsName strings

Returns:

  • (Array)

    Array of dnsName strings



261
262
263
# File 'lib/r509/asn1.rb', line 261

def dns_names
  @types[:dNSName]
end

- (Array) ip_addresses

Array of IP address strings

Returns:

  • (Array)

    Array of IP address strings



272
273
274
# File 'lib/r509/asn1.rb', line 272

def ip_addresses
  @types[:iPAddress]
end

- (Array) names

order found in the extension

Returns:

  • (Array)

    array of GeneralName objects



251
252
253
# File 'lib/r509/asn1.rb', line 251

def names
  @ordered_names
end

- (Array) rfc_822_names

Array of rfc822name strings

Returns:

  • (Array)

    Array of rfc822name strings



256
257
258
# File 'lib/r509/asn1.rb', line 256

def rfc_822_names
  @types[:rfc822Name]
end

- (Array) serialize_names

String of serialized names for OpenSSL extension creation

Returns:

  • (Array)

    string of serialized names for OpenSSL extension creation



282
283
284
285
286
287
288
289
290
291
# File 'lib/r509/asn1.rb', line 282

def serialize_names
  confs = []
  extension_strings = []
  @ordered_names.each { |item|
    data = item.serialize_name
    confs << data[:conf]
    extension_strings << data[:extension_string]
  }
  { :conf => confs.join("\n"), :extension_string => extension_strings.join(",") }
end

- (Array) uniform_resource_identifiers Also known as: uris

Array of uri strings

Returns:

  • (Array)

    Array of uri strings



266
267
268
# File 'lib/r509/asn1.rb', line 266

def uniform_resource_identifiers
  @types[:uniformResourceIdentifier]
end