Class: OpenSSL::OCSP::CertificateId (Ruby 2.3.2)
Description: Class : OpenSSL::OCSP::CertificateId - Ruby 2.3.2

- Home
- Core 2.3.2
- Std-lib 2.3.2
- Downloads

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

### Home Classes Methods

### In Files

- openssl/ossl_ns_spki.c

### Parent

Object

### Methods

- ::new
- #cmp
- #cmp_issuer
- #serial

### 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::ExtConfig
- 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::SSLContext
- OpenSSL::SSL::SSLContext::ExtConfig
- OpenSSL::SSL::SSLError
- OpenSSL::SSL::SSLErrorWaitReadable
- OpenSSL::SSL::SSLErrorWaitWritable
- OpenSSL::SSL::SSLServer
- OpenSSL::SSL::SSLSocket
- OpenSSL::SSL::SSLSocket::ExtConfig
- 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::OCSP::CertificateId

An OpenSSL::OCSP::CertificateId identifies a certificate to the CA so that a status check can be performed.

### Public Class Methods

OpenSSL::OCSP::CertificateId.new(subject, issuer, digest = nil) → certificate_id click to toggle source

Creates a new OpenSSL::OCSP::CertificateId for the given `subject` and `issuer` X509 certificates. The `digest` is used to compute the certificate ID and must be an OpenSSL::Digest instance.

                   static VALUE
    ossl_ocspcid_initialize(int argc, VALUE *argv, VALUE self)
    {
        OCSP_CERTID *id, *newid;
        X509 *x509s, *x509i;
        VALUE subject, issuer, digest;
        const EVP_MD *md;

        if (rb_scan_args(argc, argv, "21", &subject, &issuer, &digest) == 0) {
            return self;
        }

        x509s = GetX509CertPtr(subject); /* NO NEED TO DUP */
        x509i = GetX509CertPtr(issuer); /* NO NEED TO DUP */

        if (!NIL_P(digest)) {
            md = GetDigestPtr(digest);
            newid = OCSP_cert_to_id(md, x509s, x509i);
        } else {
            newid = OCSP_cert_to_id(NULL, x509s, x509i);
        }
        if(!newid)
            ossl_raise(eOCSPError, NULL);
        GetOCSPCertId(self, id);
        OCSP_CERTID_free(id);
        RDATA(self)->data = newid;

        return self;
    }

### Public Instance Methods

cmp(other) → true or false click to toggle source

Compares this certificate id with `other` and returns true if they are the same.

                   static VALUE
    ossl_ocspcid_cmp(VALUE self, VALUE other)
    {
        OCSP_CERTID *id, *id2;
        int result;

        GetOCSPCertId(self, id);
        SafeGetOCSPCertId(other, id2);
        result = OCSP_id_cmp(id, id2);

        return (result == 0) ? Qtrue : Qfalse;
    }

cmp_issuer(other) → true or false click to toggle source

Compares this certificate id's issuer with `other` and returns true if they are the same.

                   static VALUE
    ossl_ocspcid_cmp_issuer(VALUE self, VALUE other)
    {
        OCSP_CERTID *id, *id2;
        int result;

        GetOCSPCertId(self, id);
        SafeGetOCSPCertId(other, id2);
        result = OCSP_id_issuer_cmp(id, id2);

        return (result == 0) ? Qtrue : Qfalse;
    }

get_serial → Integer click to toggle source

Returns the serial number of the issuing certificate.

                   static VALUE
    ossl_ocspcid_get_serial(VALUE self)
    {
        OCSP_CERTID *id;

        GetOCSPCertId(self, id);

        return asn1integer_to_num(id->serialNumber);
    }