Class: OpenSSL::ASN1::ObjectId (Ruby 2.2.2)
Description: Class : OpenSSL::ASN1::ObjectId - Ruby 2.2.2

- Home
- Core 2.2.2
- Std-lib 2.2.2
- Downloads

Support for the Ruby 2.2 series has ended. See here for reference.

### Home Classes Methods

### In Files

- openssl/ossl_asn1.c

### Parent

OpenSSL::ASN1::Primitive

### Methods

- ::register
- #ln
- #long_name
- #oid
- #short_name
- #sn

### Class/Module Index

Quicksearch

- Integer
- OpenSSL::ASN1
- OpenSSL::ASN1::ASN1Data
- OpenSSL::ASN1::ASN1Error
- OpenSSL::ASN1::Constructive
- OpenSSL::ASN1::ObjectId
- OpenSSL::ASN1::Primitive
- OpenSSL::BN
- OpenSSL::BNError
- OpenSSL::Buffering
- OpenSSL::Cipher
- OpenSSL::Cipher::Cipher
- OpenSSL::Cipher::CipherError
- OpenSSL::Config
- OpenSSL::ConfigError
- OpenSSL::Digest
- OpenSSL::Digest::DigestError
- OpenSSL::Engine
- OpenSSL::Engine::EngineError
- OpenSSL::HMAC
- OpenSSL::HMACError
- OpenSSL::Netscape
- OpenSSL::Netscape::SPKI
- OpenSSL::Netscape::SPKIError
- OpenSSL::OCSP
- OpenSSL::OCSP::BasicResponse
- OpenSSL::OCSP::CertificateId
- OpenSSL::OCSP::OCSPError
- OpenSSL::OCSP::Request
- OpenSSL::OCSP::Response
- OpenSSL::OpenSSLError
- OpenSSL::PKCS12
- OpenSSL::PKCS12::PKCS12Error
- OpenSSL::PKCS5
- OpenSSL::PKCS5::PKCS5Error
- OpenSSL::PKCS7
- OpenSSL::PKCS7::PKCS7Error
- OpenSSL::PKCS7::RecipientInfo
- OpenSSL::PKCS7::SignerInfo
- OpenSSL::PKey
- OpenSSL::PKey::DH
- OpenSSL::PKey::DHError
- OpenSSL::PKey::DSA
- OpenSSL::PKey::DSAError
- OpenSSL::PKey::EC
- OpenSSL::PKey::EC::Group
- OpenSSL::PKey::EC::Group::Error
- OpenSSL::PKey::EC::Point
- OpenSSL::PKey::EC::Point::Error
- OpenSSL::PKey::ECError
- OpenSSL::PKey::PKey
- OpenSSL::PKey::PKeyError
- OpenSSL::PKey::RSA
- OpenSSL::PKey::RSAError
- OpenSSL::Random
- OpenSSL::Random::RandomError
- OpenSSL::SSL
- OpenSSL::SSL::Nonblock
- OpenSSL::SSL::SSLContext
- OpenSSL::SSL::SSLError
- OpenSSL::SSL::SSLErrorWaitReadable
- OpenSSL::SSL::SSLErrorWaitWritable
- OpenSSL::SSL::SSLServer
- OpenSSL::SSL::SSLSocket
- OpenSSL::SSL::Session
- OpenSSL::SSL::Session::SessionError
- OpenSSL::SSL::SocketForwarder
- OpenSSL::X509
- OpenSSL::X509::Attribute
- OpenSSL::X509::AttributeError
- OpenSSL::X509::CRL
- OpenSSL::X509::CRLError
- OpenSSL::X509::Certificate
- OpenSSL::X509::CertificateError
- OpenSSL::X509::Extension
- OpenSSL::X509::ExtensionError
- OpenSSL::X509::ExtensionFactory
- OpenSSL::X509::Name
- OpenSSL::X509::Name::RFC2253DN
- OpenSSL::X509::NameError
- OpenSSL::X509::Request
- OpenSSL::X509::RequestError
- OpenSSL::X509::Revoked
- OpenSSL::X509::RevokedError
- OpenSSL::X509::Store
- OpenSSL::X509::StoreContext
- OpenSSL::X509::StoreError
- unknown

No matching classes.

# OpenSSL::ASN1::ObjectId

Represents the primitive object id for OpenSSL::ASN1

### Public Class Methods

register(object_id, short_name, long_name) click to toggle source

This adds a new ObjectId to the internal tables. Where `object_id` is the numerical form, `short_name` is the short name, and `long_name` is the long name.

Returns `true` if successful. Raises an ASN1Error otherwise.

                   static VALUE
    ossl_asn1obj_s_register(VALUE self, VALUE oid, VALUE sn, VALUE ln)
    {
        StringValue(oid);
        StringValue(sn);
        StringValue(ln);

        if(!OBJ_create(RSTRING_PTR(oid), RSTRING_PTR(sn), RSTRING_PTR(ln)))
            ossl_raise(eASN1Error, NULL);

        return Qtrue;
    }

### Public Instance Methods

ln() click to toggle source

The long name of the ObjectId, as defined in `openssl/objects.h`.

                   static VALUE
    ossl_asn1obj_get_ln(VALUE self)
    {
        VALUE val, ret = Qnil;
        int nid;

        val = ossl_asn1_get_value(self);
        if ((nid = OBJ_txt2nid(StringValuePtr(val))) != NID_undef)
            ret = rb_str_new2(OBJ_nid2ln(nid));

        return ret;
    }

Also aliased as: long_name
long_name() click to toggle source
Alias for: ln
oid() click to toggle source

The object identifier as a String.

                   static VALUE
    ossl_asn1obj_get_oid(VALUE self)
    {
        VALUE val;
        ASN1_OBJECT *a1obj;
        char buf[128];

        val = ossl_asn1_get_value(self);
        a1obj = obj_to_asn1obj(val);
        OBJ_obj2txt(buf, sizeof(buf), a1obj, 1);
        ASN1_OBJECT_free(a1obj);

        return rb_str_new2(buf);
    }

short_name() click to toggle source
Alias for: sn
sn() click to toggle source

The short name of the ObjectId, as defined in `openssl/objects.h`.

                   static VALUE
    ossl_asn1obj_get_sn(VALUE self)
    {
        VALUE val, ret = Qnil;
        int nid;

        val = ossl_asn1_get_value(self);
        if ((nid = OBJ_txt2nid(StringValuePtr(val))) != NID_undef)
            ret = rb_str_new2(OBJ_nid2sn(nid));

        return ret;
    }

Also aliased as: short_name