(self, passphrase)
| 581 | del packet[:ctend] |
| 582 | |
| 583 | def decrypt_sk(self, passphrase): |
| 584 | # derive the first session key from our passphrase |
| 585 | sk = self.s2k.derive_key(passphrase) |
| 586 | del passphrase |
| 587 | |
| 588 | # if there is no ciphertext, then the first session key is the session key being used |
| 589 | if len(self.ct) == 0: |
| 590 | return self.symalg, sk |
| 591 | |
| 592 | # otherwise, we now need to decrypt the encrypted session key |
| 593 | m = bytearray(_decrypt(bytes(self.ct), sk, self.symalg)) |
| 594 | del sk |
| 595 | |
| 596 | symalg = SymmetricKeyAlgorithm(m[0]) |
| 597 | del m[0] |
| 598 | |
| 599 | return symalg, bytes(m) |
| 600 | |
| 601 | def encrypt_sk(self, passphrase, sk): |
| 602 | # generate the salt and derive the key to encrypt sk with from it |
nothing calls this directly
no test coverage detected