Method: Krypt::ASN1::ASN1Data#to_der

Defined in:
ext/krypt/core/krypt_asn1.c

#to_derDER-/BER-encoded String

Encodes this ASN1Data into a DER-encoded String value. Newly created ASN1Data are DER-encoded except for the possibility of infinite length encodings. If a value with BER encoding was parsed and is not modified, the BER encoding will be preserved when encoding it again.

Returns:

  • (DER-/BER-encoded String)


1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
# File 'ext/krypt/core/krypt_asn1.c', line 1038

static VALUE
krypt_asn1_data_to_der(VALUE self)
{
    krypt_asn1_data *data;
    krypt_asn1_object *object;

    int_asn1_data_get(self, data);
    object = data->object;

    if (object->bytes && object->header->tag_bytes && object->header->length_bytes)
  return int_asn1_data_to_der_cached(data->object);
    else
  return int_asn1_data_to_der_non_cached(data, self);
}