IPsec packing and unpacking