On this page
End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
OpenSSL::ASN1::Constructive
The parent class for all constructed encodings. The value attribute of a Constructive is always an Array. Attributes are the same as for ASN1Data, with the addition of tagging.
SET and SEQUENCE
Most constructed encodings come in the form of a SET or a SEQUENCE. These encodings are represented by one of the two sub-classes of Constructive:
-
OpenSSL::ASN1::Sequence
Please note that tagged sequences and sets are still parsed as instances of ASN1Data. Find further details on tagged values there.
Example - constructing a SEQUENCE
int = OpenSSL::ASN1::Integer.new(1) str = OpenSSL::ASN1::PrintableString.new('abc') sequence = OpenSSL::ASN1::Sequence.new( [ int, str ] )
Example - constructing a SET
int = OpenSSL::ASN1::Integer.new(1) str = OpenSSL::ASN1::PrintableString.new('abc') set = OpenSSL::ASN1::Set.new( [ int, str ] )
Class methods 1
Instance methods 2
May be used as a hint for encoding a value either implicitly or explicitly by setting it either to :IMPLICIT or to :EXPLICIT. tagging is not set when a ASN.1 structure is parsed using OpenSSL::ASN1.decode.