Class: HPKE::ContextR

Inherits:
Context show all
Defined in:
lib/hpke.rb

Instance Attribute Summary

Attributes inherited from Context

#base_nonce, #exporter_secret, #key, #sequence_number

Instance Method Summary collapse

Methods inherited from Context

#compute_nonce, #export, #increment_seq, #initialize

Methods included from Util

#i2osp, #os2ip, #xor

Constructor Details

This class inherits a constructor from HPKE::Context

Instance Method Details

#open(aad, ct) ⇒ Object

Raises:

  • (Exception)


288
289
290
291
292
293
294
295
# File 'lib/hpke.rb', line 288

def open(aad, ct)
  raise Exception.new('AEAD is export only') if @hpke.aead_name == :export_only

  pt = @hpke.aead_decrypt(@key, compute_nonce(@sequence_number), aad, ct)
  # TODO: catch openerror then send out own openerror
  increment_seq
  pt
end