Method: OpenSSL::OCSP::CertificateId#initialize
- Defined in:
- ossl_ocsp.c
#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;
}
|