Encrypt text and set it into cipher. :param key: the key to use for encryption :param text: the bytes value to encode :param confounder: (optional) specify the confounder bytes. Random otherwise :param key_usage_number: (optional) specify the key usage numbe
(self, key, text, confounder=None, key_usage_number=None)
| 463 | return d |
| 464 | |
| 465 | def encrypt(self, key, text, confounder=None, key_usage_number=None): |
| 466 | """ |
| 467 | Encrypt text and set it into cipher. |
| 468 | |
| 469 | :param key: the key to use for encryption |
| 470 | :param text: the bytes value to encode |
| 471 | :param confounder: (optional) specify the confounder bytes. Random otherwise |
| 472 | :param key_usage_number: (optional) specify the key usage number. |
| 473 | Guessed otherwise |
| 474 | """ |
| 475 | if key_usage_number is None: |
| 476 | key_usage_number = self.get_usage()[0] |
| 477 | self.etype = key.etype |
| 478 | self.cipher = ASN1_STRING( |
| 479 | key.encrypt(key_usage_number, text, confounder=confounder) |
| 480 | ) |
| 481 | |
| 482 | |
| 483 | class EncryptionKey(ASN1_Packet): |
no test coverage detected