lib/packetgen/plugin/esp.rb
# Encrypt in-place ESP payload and trailer.
#
# This method removes all data from +tfc+ and +padding+ fields, as their
# enciphered values are concatenated into +body+.
#
# It also removes headers under ESP from packet, as they are enciphered in
# ESP body, and then are no more accessible.
# @param [OpenSSL::Cipher] cipher keyed cipher.
#   This cipher is confidentiality-only one, or AEAD one. To use a second
#   cipher to add integrity, use +:intmode+ option.
# @param [String] iv full IV for encryption
#  * CTR and GCM modes: +iv+ is 8-bytes long.
# @param [Hash] options
# @option options [String] :salt salt value for CTR and GCM modes
# @option options [Boolean] :tfc
# @option options [Fixnum] :tfc_size ESP body size used for TFC
#   (default 1444, max size for a tunneled IPv4/ESP packet).
#   This is the maximum size for ESP packet (without IP header
#   nor Eth one).
# @option options [Fixnum] :esn 32 high-orber bits of ESN
# @option options [Fixnum] :pad_length set a padding length
# @option options [String] :padding set a padding. No check with
#   +:pad_length+ is made. If +:pad_length+ is not set, +:padding+
#   length is shortened to correct padding length
# @option options [OpenSSL::HMAC] :intmode integrity mode to use with a
#   confidentiality-only cipher. Only HMAC are supported.
# @return [self]
Encrypt in-place ESP payload and trailer.

It also removes headers under ESP from packet, as they are enciphered in
ESP body, and then are no more accessible.
Encrypt in - place ESP payload and trailer . It also removes headers under ESP from packet as they are enciphered in ESP body and then are no more accessible .
def encrypt!(cipher, iv, options={}) 
      opt = { salt: '', tfc_size: 1444 }.merge(options)
      set_crypto cipher, opt[:intmode]
      compute_iv_for_encrypting iv, opt[:salt]
      authenticate_esp_header_if_needed options, iv
      encrypt_set_pad_length
      encrypt_set_padding(opt)
      encrypt_body(opt, iv)
      set_esp_icv_if_needed
      remove_enciphered_packets
      self
    end
def encrypt! ( cipher , iv , options = { } ) opt = { salt : '' , tfc_size : 1444 } . merge ( options ) set_crypto cipher , opt [ :intmode ] compute_iv_for_encrypting iv , opt [ :salt ] authenticate_esp_header_if_needed options , iv encrypt_set_pad_length encrypt_set_padding ( opt ) encrypt_body ( opt , iv ) set_esp_icv_if_needed remove_enciphered_packets self end
Encrypt in-place ESP payload and trailer.
Encrypt in - place ESP payload and trailer .
# rubocop:disable Naming/MethodParameterName
None
self
cipher
iv
options
:intmode integrity mode to use with a confidentiality-only cipher. Only HMAC are supported.
: intmode integrity mode to use with a confidentiality - only cipher . Only HMAC are supported .
None