Decrypt (and decapsulate) an IP(v6) packet containing ESP or AH. :param pkt: the packet to decrypt :param verify: if False, do not perform the integrity check :param esn_en: extended sequence number enable which allows to use 64-bit seq
(self, pkt, verify=True, esn_en=None, esn=None)
| 1243 | return ip_header / payload |
| 1244 | |
| 1245 | def decrypt(self, pkt, verify=True, esn_en=None, esn=None): |
| 1246 | """ |
| 1247 | Decrypt (and decapsulate) an IP(v6) packet containing ESP or AH. |
| 1248 | |
| 1249 | :param pkt: the packet to decrypt |
| 1250 | :param verify: if False, do not perform the integrity check |
| 1251 | :param esn_en: extended sequence number enable which allows to use |
| 1252 | 64-bit sequence number instead of 32-bit when using an |
| 1253 | AEAD algorithm |
| 1254 | :param esn: extended sequence number (32 MSB) |
| 1255 | :returns: the decrypted/decapsulated packet |
| 1256 | :raise scapy.layers.ipsec.IPSecIntegrityError: if the integrity check |
| 1257 | fails |
| 1258 | """ |
| 1259 | if not isinstance(pkt, self.SUPPORTED_PROTOS): |
| 1260 | raise TypeError('cannot decrypt %s, supported protos are %s' |
| 1261 | % (pkt.__class__, self.SUPPORTED_PROTOS)) |
| 1262 | |
| 1263 | if self.proto is ESP and pkt.haslayer(ESP): |
| 1264 | return self._decrypt_esp(pkt, verify=verify, |
| 1265 | esn_en=esn_en, esn=esn) |
| 1266 | elif self.proto is AH and pkt.haslayer(AH): |
| 1267 | return self._decrypt_ah(pkt, verify=verify, esn_en=esn_en, esn=esn) |
| 1268 | else: |
| 1269 | raise TypeError('%s has no %s layer' % (pkt, self.proto.name)) |
nothing calls this directly
no test coverage detected