Update a decrypted ticket by credentials ID
(self, i, decTkt, resign=False, hash=None, kdc_hash=None)
| 621 | raise |
| 622 | |
| 623 | def update_ticket(self, i, decTkt, resign=False, hash=None, kdc_hash=None): |
| 624 | """ |
| 625 | Update a decrypted ticket by credentials ID |
| 626 | """ |
| 627 | # Get CCCredential |
| 628 | cred = self.ccache.credentials[i] |
| 629 | tkt = KRB_Ticket(cred.ticket.data) |
| 630 | |
| 631 | # Optional: resign the new ticket |
| 632 | if resign: |
| 633 | # resign the ticket |
| 634 | decTkt = self._resign_ticket( |
| 635 | decTkt, |
| 636 | tkt.getSPN(), |
| 637 | hash=hash, |
| 638 | kdc_hash=kdc_hash, |
| 639 | ) |
| 640 | |
| 641 | # Encrypt the new ticket |
| 642 | key = self._prompt_hash( |
| 643 | tkt.getSPN(), |
| 644 | etype=tkt.encPart.etype.val, |
| 645 | hash=hash, |
| 646 | ) |
| 647 | tkt.encPart.encrypt(key, bytes(decTkt)) |
| 648 | |
| 649 | # Update the CCCredential with the new ticket |
| 650 | cred.set_from_krb( |
| 651 | tkt, |
| 652 | decTkt, |
| 653 | decTkt.key.toKey(), |
| 654 | decTkt, |
| 655 | ) |
| 656 | |
| 657 | def remove_krb(self, i): |
| 658 | """ |
no test coverage detected