Module: OpenSSL::ASN1::TaggedASN1Data
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
| Included In: | |
| Defined in: | ext/openssl/lib/openssl/asn1.rb | 
Instance Attribute Summary
- 
    
      #tagging  
    
    rw
    May be used as a hint for encoding a value either implicitly or explicitly by setting it either to :IMPLICITor to:EXPLICIT.
Instance Method Summary
- 
    
      OpenSSL::ASN1::Primitive.new(value [, tag, tagging, tag_class ])  ⇒ Primitive 
    
    value: is mandatory. 
Instance Attribute Details
#tagging (rw)
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.
# File 'ext/openssl/lib/openssl/asn1.rb', line 83
attr_accessor :tagging
Instance Method Details
OpenSSL::ASN1::Primitive.new(value [, tag, tagging, tag_class ]) ⇒ Primitive
value: is mandatory.
tag: optional, may be specified for tagged values. If no tag is specified, the UNIVERSAL tag corresponding to the Primitive sub-class is used by default.
tagging: may be used as an encoding hint to encode a value either explicitly or implicitly, see ::OpenSSL::ASN1 for possible values.
tag_class: if tag and tagging are nil then this is set to :UNIVERSAL by default. If either tag or tagging are set then :CONTEXT_SPECIFIC is used as the default. For possible values please cf. ::OpenSSL::ASN1.
Example
int = OpenSSL::ASN1::Integer.new(42)
zero_tagged_int = OpenSSL::ASN1::Integer.new(42, 0, :IMPLICIT)
private_explicit_zero_tagged_int = OpenSSL::ASN1::Integer.new(42, 0, :EXPLICIT, :PRIVATE)# File 'ext/openssl/lib/openssl/asn1.rb', line 107
def initialize(value, tag = nil, tagging = nil, tag_class = nil) tag ||= ASN1.take_default_tag(self.class) raise ASN1Error, "must specify tag number" unless tag if tagging raise ASN1Error, "invalid tagging method" unless tagging.is_a?(Symbol) end tag_class ||= tagging ? :CONTEXT_SPECIFIC : :UNIVERSAL raise ASN1Error, "invalid tag class" unless tag_class.is_a?(Symbol) @tagging = tagging super(value ,tag, tag_class) end