method
to_der
v1_9_2_180 -
Show latest stable
-
0 notes -
Class: Constructive
- 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 (38)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
to_der()
public
Hide source
static VALUE ossl_asn1cons_to_der(VALUE self) { int tag, tn, tc, explicit; long seq_len, length; unsigned char *p; VALUE value, str; tag = ossl_asn1_default_tag(self); tn = NUM2INT(ossl_asn1_get_tag(self)); tc = ossl_asn1_tag_class(self); explicit = ossl_asn1_is_explicit(self); value = join_der(ossl_asn1_get_value(self)); seq_len = ASN1_object_size(1, RSTRING_LEN(value), tag); length = ASN1_object_size(1, seq_len, tn); str = rb_str_new(0, length); p = (unsigned char *)RSTRING_PTR(str); if(tc == V_ASN1_UNIVERSAL) ASN1_put_object(&p, 1, RSTRING_LEN(value), tn, tc); else{ if(explicit){ ASN1_put_object(&p, 1, seq_len, tn, tc); ASN1_put_object(&p, 1, RSTRING_LEN(value), tag, V_ASN1_UNIVERSAL); } else ASN1_put_object(&p, 1, RSTRING_LEN(value), tn, tc); } memcpy(p, RSTRING_PTR(value), RSTRING_LEN(value)); p += RSTRING_LEN(value); ossl_str_adjust(str, p); return str; }