Class: OpenSSL::OCSP::CertificateId
- Inherits:
 - 
      Object
      
        
- Object
 - OpenSSL::OCSP::CertificateId
 
 
- Defined in:
 - ossl_ocsp.c
 
Instance Method Summary collapse
- 
  
    
      #cmp(other)  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
Compares this certificate id with
otherand returns true if they are the same. - 
  
    
      #cmp_issuer(other)  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
Compares this certificate id’s issuer with
otherand returns true if they are the same. - 
  
    
      #OpenSSL::OCSP::CertificateId.new(subject, issuer, digest = nil)  ⇒ Object 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
Creates a new OpenSSL::OCSP::CertificateId for the given
subjectandissuerX509 certificates. - 
  
    
      #get_serial  ⇒ Integer 
    
    
  
  
  
  
  
  
  
  
  
    
Returns the serial number of the issuing certificate.
 
Constructor Details
#OpenSSL::OCSP::CertificateId.new(subject, issuer, digest = nil) ⇒ Object
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.
      870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898  | 
    
      # File 'ossl_ocsp.c', line 870
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;
}
     | 
  
Instance Method Details
#cmp(other) ⇒ Boolean
Compares this certificate id with other and returns true if they are the same.
      907 908 909 910 911 912 913 914 915 916 917 918  | 
    
      # File 'ossl_ocsp.c', line 907
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) ⇒ Boolean
Compares this certificate id’s issuer with other and returns true if they are the same.
      928 929 930 931 932 933 934 935 936 937 938 939  | 
    
      # File 'ossl_ocsp.c', line 928
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
Returns the serial number of the issuing certificate.
      948 949 950 951 952 953 954 955 956  | 
    
      # File 'ossl_ocsp.c', line 948
static VALUE
ossl_ocspcid_get_serial(VALUE self)
{
    OCSP_CERTID *id;
    GetOCSPCertId(self, id);
    return asn1integer_to_num(id->serialNumber);
}
     |