Class: RASN1::Types::OctetString

Inherits:
Primitive show all
Defined in:
lib/rasn1/types/octet_string.rb

Overview

ASN.1 Octet String

An OCTET STRINT may contain another primtive object:

os = OctetString.new
int = Integer.new
int.value = 12
os.value = int
os.to_der   # => DER string with INTEGER in OCTET STRING

Author:

  • Sylvain Daubert

Constant Summary collapse

ID =

OctetString id value

4

Constants inherited from Primitive

Primitive::ASN1_PC

Constants inherited from Base

Base::CLASSES, Base::CLASS_MASK, Base::INDEFINITE_LENGTH, Base::MULTI_OCTETS_ID

Instance Attribute Summary

Attributes inherited from Base

#asn1_class, #default, #name, #options

Instance Method Summary collapse

Methods inherited from Base

#==, #can_build?, constrained?, #constructed?, #do_parse_explicit_with_tracing, #do_parse_with_tracing, encoded_type, #explicit?, #id, #implicit?, #initialize, #initialize_copy, #optional?, parse, #parse!, #primitive?, #specific_initializer, start_tracing, stop_tracing, #tagged?, #to_der, #trace, type, #type, #value, #value=, #value?, #value_size, #void_value

Constructor Details

This class inherits a constructor from RASN1::Types::Base

Instance Method Details

#inspect(level = 0) ⇒ String

Parameters:

  • level (::Integer) (defaults to: 0)

Returns:

  • (String)


20
21
22
23
# File 'lib/rasn1/types/octet_string.rb', line 20

def inspect(level=0)
  str = common_inspect(level)
  str << " #{value.inspect}"
end