class ASN1::BER

Defined in:

bindata/asn1.cr
bindata/asn1/data_types.cr
bindata/asn1/identifier.cr
bindata/asn1/length.cr

Constant Summary

BIT_PARTS = [] of Nil
ENDIAN = ["big"]
INDEX = [-1]
PARTS = [{"basic", identifier, Identifier, nil, nil, nil, nil}, {"basic", length, Length, nil, nil, nil, nil}] of Nil

Instance Method Summary

Instance methods inherited from class BinData

__format__ : IO::ByteFormat __format__, read(io : IO) : IO read, to_io(io : IO, format : IO::ByteFormat = IO::ByteFormat::SystemEndian) to_io, to_slice to_slice, write(io : IO) : IO write

Class methods inherited from class BinData

from_io(io : IO, format : IO::ByteFormat = IO::ByteFormat::SystemEndian) from_io

Instance Method Detail

def __format__ : IO::ByteFormat #

[View source]
def children #

Extracts children from the payload


[View source]
def children=(parts) #

[View source]
def constructed #

[View source]
def constructed=(custom : Bool) #

[View source]
def extended #

[View source]
def extended=(parts : Array(ExtendedIdentifier)) #

[View source]
def extended? #

[View source]
def get_bitstring #

[View source]
def get_boolean #

[View source]
def get_bytes : Slice(UInt8) #

Returns the raw bytes


[View source]
def get_hexstring(universal = true, tag = UniversalTags::OctetString) #

Gets a hex representation of the bytes


[View source]
def get_integer : Int64 #

[View source]
def get_integer_bytes : Bytes #

[View source]
def get_object_id #

Returns the object ID in string format


[View source]
def get_string #

Returns a UTF8 string


[View source]
def identifier : Identifier #

Components of a BER object


def identifier=(identifier : Identifier) #

Components of a BER object


def inspect(io : IO) : Nil #
Description copied from class Reference

Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).inspect # => #<Person:0x10fd31f20 @name="John", @age=32>

[View source]
def length : Length #

def length=(length : Length) #

def payload : Bytes #

[View source]
def payload=(payload : Bytes) #

[View source]
def read(io : IO) : IO #

[View source]
def sequence? #

Check if this can be expanded into multiple sub-entries


[View source]
def set_boolean(value) #

[View source]
def set_bytes(data, tag = UniversalTags::OctetString, tag_class = TagClass::Universal) #

[View source]
def set_hexstring(string, tag = UniversalTags::OctetString, tag_class = TagClass::Universal) #

Sets bytes from a hexstring


[View source]
def set_integer(value) #

[View source]
def set_object_id(oid) #

Sets a string representing an object ID


[View source]
def set_string(string, tag = UniversalTags::UTF8String, tag_class = TagClass::Universal) #

Sets a UTF8 string


[View source]
def size #

[View source]
def tag #

[View source]
def tag_class #

[View source]
def tag_class=(tag : TagClass) #

[View source]
def tag_number #

[View source]
def tag_number=(tag_type : Int | UniversalTags) #

[View source]
def write(io : IO) : IO #

[View source]