Method: OpenSSL::ASN1::ASN1Data#initialize

Defined in:
ext/openssl/ossl_asn1.c

#OpenSSL::ASN1::ASN1Data.new(value, tag, tag_class) ⇒ ASN1Data

value: Please have a look at Constructive and Primitive to see how Ruby types are mapped to ASN.1 types and vice versa.

tag: An Integer indicating the tag number.

tag_class: A Symbol indicating the tag class. Please cf. ASN1 for possible values.

Example

asn1_int = OpenSSL::ASN1Data.new(42, 2, :UNIVERSAL) # => Same as OpenSSL::ASN1::Integer.new(42)
tagged_int = OpenSSL::ASN1Data.new(42, 0, :CONTEXT_SPECIFIC) # implicitly 0-tagged INTEGER


668
669
670
671
672
673
674
675
676
677
678
679
# File 'ext/openssl/ossl_asn1.c', line 668

static VALUE
ossl_asn1data_initialize(VALUE self, VALUE value, VALUE tag, VALUE tag_class)
{
    if(!SYMBOL_P(tag_class))
        ossl_raise(eASN1Error, "invalid tag class");
    ossl_asn1_set_tag(self, tag);
    ossl_asn1_set_value(self, value);
    ossl_asn1_set_tag_class(self, tag_class);
    ossl_asn1_set_indefinite_length(self, Qfalse);

    return self;
}