(self, manifest_data=None)
| 366 | self.init_from_given_data(crypt_key=data[0:64], id_key=data[64:96], chunk_seed=chunk_seed) |
| 367 | |
| 368 | def init_ciphers(self, manifest_data=None): |
| 369 | enc_key, enc_hmac_key = self.crypt_key[0:32], self.crypt_key[32:] |
| 370 | self.cipher = self.CIPHERSUITE(mac_key=enc_hmac_key, enc_key=enc_key, header_len=1, aad_offset=1) |
| 371 | if manifest_data is None: |
| 372 | nonce = 0 |
| 373 | else: |
| 374 | self.assert_type(manifest_data[0]) |
| 375 | # manifest_blocks is a safe upper bound on the amount of cipher blocks needed |
| 376 | # to encrypt the manifest. depending on the ciphersuite and overhead, it might |
| 377 | # be a bit too high, but that does not matter. |
| 378 | manifest_blocks = num_cipher_blocks(len(manifest_data)) |
| 379 | nonce = self.cipher.extract_iv(manifest_data) + manifest_blocks |
| 380 | self.cipher.set_iv(nonce) |
| 381 | |
| 382 | |
| 383 | class FlexiKey: |
no test coverage detected