190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
# File 'lib/pq_crypto/seal/format.rb', line 190
def parse(bytes, offset, )
raw, = Binary.read_bytes(bytes, offset, Format.section_length())
reader = Binary::Reader.new(raw)
wrap_suite = reader.u16
unless wrap_suite == WRAP_SUITE_MLKEM768_X25519_AEGIS256
raise UnsupportedSuiteError, "unsupported wrap suite #{wrap_suite}"
end
section_id = reader.bytes(SECTION_ID_BYTES)
Section.new(
wrap_suite_id: wrap_suite,
section_id: section_id,
raw: raw,
slots_offset: reader.offset,
slots_length: raw.bytesize - reader.offset
)
end
|