Method: OpenSSL::X509::Attribute#oid

Defined in:
ossl_x509attr.c

#oidString



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'ossl_x509attr.c', line 173

static VALUE
ossl_x509attr_get_oid(VALUE self)
{
    X509_ATTRIBUTE *attr;
    ASN1_OBJECT *oid;
    BIO *out;
    VALUE ret;
    int nid;

    GetX509Attr(self, attr);
    oid = X509_ATTRIBUTE_get0_object(attr);
    if ((nid = OBJ_obj2nid(oid)) != NID_undef)
  ret = rb_str_new2(OBJ_nid2sn(nid));
    else{
  if (!(out = BIO_new(BIO_s_mem())))
      ossl_raise(eX509AttrError, NULL);
  i2a_ASN1_OBJECT(out, oid);
  ret = ossl_membio2str(out);
    }

    return ret;
}