acquire.acquire.crypt

Module Contents

Classes

EncryptedStream

Encrypted AES-256-GCM stream.

Functions

Attributes

acquire.acquire.crypt.HAS_PYCRYPTODOME = True
acquire.acquire.crypt.c_acquire
acquire.acquire.crypt.FILE_MAGIC = b'ENCRYPTEDACQUIRE'
acquire.acquire.crypt.FILE_VERSION = 1
acquire.acquire.crypt.HEADER_MAGIC = b'KUSJESVANSRT'
acquire.acquire.crypt.FOOTER_MAGIC = b'FOOTER'
class acquire.acquire.crypt.EncryptedStream(fh, public_key)

Bases: io.RawIOBase

Encrypted AES-256-GCM stream.

Generates a random key and IV and uses AES-256-GCM to encrypt all written data. The key and IV are encrypted with the given RSA public key and written as header.

The header is included as AD to the AEAD cipher. The digest is written when the file is closed in the footer.

Parameters:
  • fh – The file-like object to write to.

  • public_key – The RSA public key to encrypt the header with.

write_header(header)
write(b)
tell()

Return current stream position.

seek(pos, whence=io.SEEK_CUR)

Change stream position.

Change the stream position to the given byte offset. The offset is interpreted relative to the position indicated by whence. Values for whence are:

  • 0 – start of stream (the default); offset should be zero or positive

  • 1 – current stream position; offset may be negative

  • 2 – end of stream; offset is usually negative

Return the new absolute position.

close()

Flush and close the IO object.

This method has no effect if the file is already closed.

finalize()
acquire.acquire.crypt.key_fingerprint(pkey)