value() public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
static VALUE
ossl_x509attr_get_value(VALUE self)
{
    X509_ATTRIBUTE *attr;
    VALUE str, asn1;
    long length;
    unsigned char *p;

    GetX509Attr(self, attr);
    if(attr->value.ptr == NULL) return Qnil;
    if(OSSL_X509ATTR_IS_SINGLE(attr)){
        length = i2d_ASN1_TYPE(attr->value.single, NULL);
        str = rb_str_new(0, length);
        p = (unsigned char *)RSTRING_PTR(str);
        i2d_ASN1_TYPE(attr->value.single, &p);
        ossl_str_adjust(str, p);
    }
    else{
        length = i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, NULL,
                        i2d_ASN1_TYPE, V_ASN1_SET, V_ASN1_UNIVERSAL, 0);
        str = rb_str_new(0, length);
        p = (unsigned char *)RSTRING_PTR(str);
        i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, &p,
                        i2d_ASN1_TYPE, V_ASN1_SET, V_ASN1_UNIVERSAL, 0);
        ossl_str_adjust(str, p);
    }
    asn1 = rb_funcall(mASN1, rb_intern("decode"), 1, str);

    return asn1;
}
Register or log in to add new notes.