An X.509 name represents a hostname, email address or other entity associated with a public key.

You can create a Name by parsing a distinguished name String or by supplying the distinguished name as an Array.

name = OpenSSL::X509::Name.parse 'CN=nobody/DC=example'

name = [['CN', 'nobody'], ['DC', 'example']]

The default object type for name entries.

The default object type template for name entries.

A flag for to_s.

Breaks the name returned into multiple lines if longer than 80 characters.

A flag for to_s.

Returns an RFC2253 format name.

A flag for to_s.

Returns a more readable format than RFC2253.

A flag for to_s.

Returns a multiline format.

Class Methods

Creates a new Name.

A name may be created from a DER encoded string der, an Array representing a distinguished_name or a distinguished_name along with a template.

name = [['CN', 'nobody'], ['DC', 'example']]

name = name.to_der

See add_entry for a description of the distinguished_name Array’s contents

An alias for parse_openssl
No documentation available
No documentation available
Instance Methods
An alias for cmp

Adds a new entry with the given oid and value to this name. The oid is an object identifier defined in ASN.1. Some common OIDs are:


Country Name


Common Name


Domain Component


Organization Name


Organizational Unit Name


State or Province Name

Compares this Name with other and returns 0 if they are the same and -1 or +1 if they are greater or less than each other respectively.

Returns true if name and other refer to the same hash key.

The hash value returned is suitable for use as a certificate’s filename in a CA path.

Returns an MD5 based hash used in OpenSSL 0.9.X.

No documentation available

Returns an Array representation of the distinguished name suitable for passing to ::new

Converts the name to DER encoding