split the packet into associated data, plaintext or ciphertext, and optional ICV
(pkt, assoclen, icvlen=0)
| 87 | |
| 88 | @staticmethod |
| 89 | def split_pkt(pkt, assoclen, icvlen=0): |
| 90 | """ |
| 91 | split the packet into associated data, plaintext or ciphertext, and |
| 92 | optional ICV |
| 93 | """ |
| 94 | data = raw(pkt) |
| 95 | assoc = data[:assoclen] |
| 96 | if icvlen: |
| 97 | icv = data[-icvlen:] |
| 98 | enc = data[assoclen:-icvlen] |
| 99 | else: |
| 100 | icv = b'' |
| 101 | enc = data[assoclen:] |
| 102 | return assoc, enc, icv |
| 103 | |
| 104 | def e_bit(self): |
| 105 | """returns the value of the E bit for packets sent through this SA""" |