def load(self, filename):
aead_f = open(filename, "<STR_LIT:rb>")<EOL>buf = aead_f.read(<NUM_LIT>)<EOL>if buf.startswith(YHSM_AEAD_CRLF_File_Marker):<EOL><INDENT>buf = YHSM_AEAD_File_Marker + buf[len(YHSM_AEAD_CRLF_File_Marker):]<EOL><DEDENT>if buf.startswith(YHSM_AEAD_File_Marker):<EOL><INDENT>if buf[len(YHSM_AEAD_File_Marker)] == chr(<NUM_LIT:1>):<EOL><INDENT>fmt = "<STR_LIT>" % (pyhsm.defines.YSM_AEAD_NONCE_SIZE)<EOL>self.key_handle, self.nonce = struct.unpack_from(fmt, buf, len(YHSM_AEAD_File_Marker) + <NUM_LIT:1>)<EOL>self.data = buf[len(YHSM_AEAD_File_Marker) + <NUM_LIT:1> + struct.calcsize(fmt):]<EOL><DEDENT>else:<EOL><INDENT>raise pyhsm.exception.YHSM_Error('<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.data = buf[:pyhsm.defines.YSM_MAX_KEY_SIZE + pyhsm.defines.YSM_BLOCK_SIZE]<EOL><DEDENT>aead_f.close()<EOL>
Load AEAD from a file.

@param filename: File to read AEAD from
@type filename: string