method
to_a
v1_9_3_125 -
Show latest stable
-
0 notes -
Class: Name
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378 (0)
- 1_9_2_180 (0)
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (38)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
to_a()
public
Hide source
static VALUE ossl_x509name_to_a(VALUE self) { X509_NAME *name; X509_NAME_ENTRY *entry; int i,entries,nid; char long_name[512]; const char *short_name; VALUE ary, vname, 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); } nid = OBJ_ln2nid(long_name); if (nid == NID_undef) { vname = rb_str_new2((const char *) &long_name); } else { short_name = OBJ_nid2sn(nid); vname = rb_str_new2(short_name); /*do not free*/ } ary = rb_ary_new3(3, vname, rb_str_new((const char *)entry->value->data, entry->value->length), INT2FIX(entry->value->type)); rb_ary_push(ret, ary); } return ret; }