Flowdock
to_a() public

No documentation

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

Hide source
static VALUE 
ossl_x509name_to_a(VALUE self)
{
    X509_NAME *name;
    X509_NAME_ENTRY *entry;
    int i,entries;
    char long_name[512];
    const char *short_name;
    VALUE ary, ret;
        
    GetX509Name(self, name);
    entries = X509_NAME_entry_count(name);
    if (entries < 0) {
        OSSL_Debug("name entries < 0!");
        return rb_ary_new();
    }
    ret = rb_ary_new2(entries);
    for (i=0; i<entries; i++) {
        if (!(entry = X509_NAME_get_entry(name, i))) {
            ossl_raise(eX509NameError, NULL);
        }
        if (!i2t_ASN1_OBJECT(long_name, sizeof(long_name), entry->object)) {
            ossl_raise(eX509NameError, NULL);
        }
        short_name = OBJ_nid2sn(OBJ_ln2nid(long_name));
        ary = rb_ary_new3(3, rb_str_new2(short_name),
                          rb_str_new((const char *)entry->value->data, entry->value->length),
                          INT2FIX(entry->value->type));
        rb_ary_push(ret, ary);
    }
    return ret;
}
Register or log in to add new notes.