instance method
OpenSSL::X509::Certificate#tbs_bytes
cert.tbs_bytes => string
ext/openssl/ossl_x509cert.c
View on GitHub ↗
static VALUE
ossl_x509_tbs_bytes(VALUE self)
{
X509 *x509;
int len;
unsigned char *p0;
VALUE str;
GetX509(self, x509);
len = i2d_re_X509_tbs(x509, NULL);
if (len <= 0) {
ossl_raise(eX509CertError, "i2d_re_X509_tbs");
}
str = rb_str_new(NULL, len);
p0 = (unsigned char *)RSTRING_PTR(str);
if (i2d_re_X509_tbs(x509, &p0) <= 0) {
ossl_raise(eX509CertError, "i2d_re_X509_tbs");
}
ossl_str_adjust(str, p0);
return str;
}
Returns the DER-encoded bytes of the certificate’s to be signed certificate. This is mainly useful for validating embedded certificate transparency signatures.