:py:mod:`acquire.acquire.crypt` =============================== .. py:module:: acquire.acquire.crypt Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: acquire.acquire.crypt.EncryptedStream Functions ~~~~~~~~~ .. autoapisummary:: :nosignatures: acquire.acquire.crypt.key_fingerprint Attributes ~~~~~~~~~~ .. autoapisummary:: acquire.acquire.crypt.HAS_PYCRYPTODOME acquire.acquire.crypt.c_acquire acquire.acquire.crypt.FILE_MAGIC acquire.acquire.crypt.FILE_VERSION acquire.acquire.crypt.HEADER_MAGIC acquire.acquire.crypt.FOOTER_MAGIC .. py:data:: HAS_PYCRYPTODOME :value: True .. py:data:: c_acquire .. py:data:: FILE_MAGIC :value: b'ENCRYPTEDACQUIRE' .. py:data:: FILE_VERSION :value: 1 .. py:data:: HEADER_MAGIC :value: b'KUSJESVANSRT' .. py:data:: FOOTER_MAGIC :value: b'FOOTER' .. py:class:: EncryptedStream(fh, public_key) Bases: :py:obj:`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. :param fh: The file-like object to write to. :param public_key: The RSA public key to encrypt the header with. .. py:method:: write_header(header) .. py:method:: write(b) .. py:method:: tell() Return current stream position. .. py:method:: 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. .. py:method:: close() Flush and close the IO object. This method has no effect if the file is already closed. .. py:method:: finalize() .. py:function:: key_fingerprint(pkey)