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

Direct Known Subclasses

IA5String, NumericString, PrintableString, Utf8String

Constant Summary collapse

TAG =
0x04

Constants inherited from Primitive

Primitive::ASN1_PC

Constants inherited from Base

Base::CLASSES, Base::INDEFINITE_LENGTH, Base::MAX_TAG

Instance Attribute Summary

Attributes inherited from Base

#asn1_class, #default, #name, #value

Instance Method Summary collapse

Methods inherited from Base

#==, #constructed?, encode_type, #explicit?, #implicit?, #initialize, #initialize_copy, #optional?, parse, #parse!, #primitive?, #tag, #tagged?, #to_der, #type, type, #value_size

Constructor Details

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

Instance Method Details

#inspect(level = 0) ⇒ Object



16
17
18
19
20
21
# File 'lib/rasn1/types/octet_string.rb', line 16

def inspect(level=0)
  str = ''
  str << '  ' * level if level > 0
  str << "#{@name} " unless @name.nil?
  str << "#{type}: #{value.inspect}"
end