Class: HPKE::ContextS

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

Instance Method Summary collapse

Instance Method Details

#seal(aad, pt) ⇒ Object

Raises:

  • (Exception)


303
304
305
306
307
308
309
# File 'lib/hpke.rb', line 303

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

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