Class: EzCrypto::Name

### Home Classes Methods

### In Files

- lib/ezsig.rb

### Parent

Object

### Methods

- ::new
- #[]
- #c
- #cn
- #common_name
- #country
- #email
- #l
- #locality
- #method_missing
- #name
- #o
- #organisation
- #organisational_unit
- #organization
- #organizational_unit
- #ou
- #province
- #st
- #state
- #to_s

### Files

- CHANGELOG
- README.rdoc
- README_ACTIVE_CRYPTO
- README_DIGITAL_SIGNATURES

### Class/Module Index

Quicksearch

- EzCrypto
- EzCrypto::Certificate
- EzCrypto::Digester
- EzCrypto::Key
- EzCrypto::Name
- EzCrypto::Signer
- EzCrypto::TrustStore
- EzCrypto::Verifier
- ActiveCrypto
- ActiveCrypto::AssociationKeyHolder
- ActiveCrypto::ClassMethods
- ActiveCrypto::Encrypted
- ActiveCrypto::Encrypted::ClassAccessors
- ActiveCrypto::KeyHolder
- ActiveCrypto::MissingKeyError

No matching classes.

# EzCrypto::Name

A handy ruby wrapper around OpenSSL's Name object. This was created to make it really easy to extract information out of the certificate.

### Public Class Methods

new(name) click to toggle source

Initializes the Name object with the underlying OpenSSL Name object. You generally do not need to use this. Rather use the Certificates subject or issuer methods.

    # File lib/ezsig.rb, line 385
    def initialize(name)
      @name=name
      @attributes={}
      name.to_s.split(/\//).each do |field|
        key, val = field.split(/=/,2)
        if key
          @attributes[key.to_sym]=val
        end
      end
    end

### Public Instance Methods

[](attr_key) click to toggle source

Lookup fields in the certificate.

    # File lib/ezsig.rb, line 463
    def [](attr_key)
      @attributes[attr_key.to_sym]
    end

c() click to toggle source
Alias for: country
cn() click to toggle source
Alias for: common_name
common_name() click to toggle source

The common name. For SSL this means the domain name. For personal certificates it is the name.

    # File lib/ezsig.rb, line 454
    def common_name
      self[:CN]
    end

Also aliased as: name, cn
country() click to toggle source

The 2 letter country code of the name

    # File lib/ezsig.rb, line 412
    def country
      self[:C]
    end

Also aliased as: c
email() click to toggle source

Returns the email if present in the name

    # File lib/ezsig.rb, line 406
    def email
      self[:emailAddress]
    end

l() click to toggle source
Alias for: locality
locality() click to toggle source

The locality

    # File lib/ezsig.rb, line 428
    def locality
      self[:L]
    end

Also aliased as: l
method_missing(method) click to toggle source

    # File lib/ezsig.rb, line 467
    def method_missing(method)
      self[method]
    end

name() click to toggle source
Alias for: common_name
o() click to toggle source
Alias for: organization
organisation() click to toggle source
Alias for: organization
organisational_unit() click to toggle source
Alias for: organizational_unit
organization() click to toggle source

The Organization

    # File lib/ezsig.rb, line 445
    def organization
      self[:O]
    end

Also aliased as: o, organisation
organizational_unit() click to toggle source

The Organizational Unit

    # File lib/ezsig.rb, line 436
    def organizational_unit
      self[:OU]
    end

Also aliased as: ou, organisational_unit
ou() click to toggle source
Alias for: organizational_unit
province() click to toggle source
Alias for: state
st() click to toggle source
Alias for: state
state() click to toggle source

The state or province code

    # File lib/ezsig.rb, line 419
    def state
      self[:ST]
    end

Also aliased as: st, province
to_s() click to toggle source

Returns the full name object in classic horrible X500 format.

    # File lib/ezsig.rb, line 399
    def to_s
      @name.to_s
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.