Class: HPKE::ContextS

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

#seal(aad, pt) ⇒ Object

Raises:

  • (Exception)


278
279
280
281
282
283
284
# File 'lib/hpke.rb', line 278

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

  ct = @hpke.aead_encrypt(@key, compute_nonce(@sequence_number), aad, pt)
  increment_seq
  ct
end