"""Header not valid."""
pass
+class InvalidIVFixedPart (Exception):
+ """IV fixed part not in supplied list."""
+ pass
+
class DecryptionError (Exception):
"""Error during decryption."""
pass
if fixedparts is not None:
self.pfx = fixedparts
self.pfx.sort ()
- super().__init__ (password, paramversion, nacl, counter=counter,
- nextpfx=lambda: self.pfx.pop())
+ super().__init__ (password, paramversion, nacl, counter=counter)
super().__init__ (password, paramversion, nacl, counter=counter)
self.set_object_counter (self.cnt + 1)
iv = hdr ["iv"]
if self.pfx is not None and self.valid_pfx (iv) is False:
- raise Exception ("XXX iv %r has invalid fixed part" % iv)
+ fixed, _ = struct.unpack (FMT_I2N_IV, iv)
+ raise InvalidIVFixedPart ("iv [%r] has invalid fixed part [%r]"
+ % (iv, fixed))
self.tag = hdr ["tag"]
defs = ENCRYPTION_PARAMETERS.get(paramversion)
enc = defs ["enc"]