rasn1 0.3.0 has been released.
* home: <https://github.com/sdaubert/rasn1>
* bugs: <https://github.com/sdaubert/rasn1/issues>
* doc: <http://www.rubydoc.info/gems/rasn1>
RASN1 is a pure ruby ASN.1 library. RASN1 helps to create ASN.1 parsers
and encoders.
The RASN1::Model class is the entry point to create a parser/encoder.
Simple example:
From ASN1. definition:
Record ::= SEQUENCE {
id INTEGER,
room [0] INTEGER OPTIONAL,
house [1] INTEGER DEFAULT 0
}
a model may be defined this way:
class Record < RASN1::Model
sequence :record,
content: [integer(:id),
integer(:room, implicit: 0, optional: true),
integer(:house, implicit: 1, default: 0)]
end
Then, parsing is as simple as:
record = Record.parse(der_string)
record[:id] # => RASN1::Integer
record[:id].value # => Integer
And encoding:
record[:id].value = 16_543_154
record.to_der # => String
Changes:
### 0.3.0 / 2017-08-10
* add ASN.1 types IA5Sring, PrintableString, NumericString and
VisibleString,
* add Model#[]= to directly set value of an element
* add Model#type and Model.type to mimic Types::Base API
* add Model delegation to its root element for unknown methods
* fix Types::Choice#parse! which did not return number of parsed bytes