lib/packetgen/plugin/esp.rb
# Decrypt in-place ESP payload and trailer.
# @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 [Hash] options
# @option options [Boolean] :parse parse deciphered payload to retrieve
#   headers (default: +true+)
# @option options [Fixnum] :icv_length ICV length for captured packets,
#   or read from PCapNG files
# @option options [String] :salt salt value for CTR and GCM modes
# @option options [Fixnum] :esn 32 high-orber bits of ESN
# @option options [OpenSSL::HMAC] :intmode integrity mode to use with a
#   confidentiality-only cipher. Only HMAC are supported.
# @return [Boolean] +true+ if ESP packet is authenticated
Decrypt in-place ESP payload and trailer.
Decrypt in - place ESP payload and trailer .
def decrypt!(cipher, options={})
      opt = { salt: '', parse: true }.merge(options)
      set_crypto cipher, opt[:intmode]
      iv = compute_iv_for_decrypting(opt[:salt], self[:body])
      if authenticated? && (@icv_length.zero? || opt[:icv_length])
        check_icv_length(opt)
        decrypt_format_packet
      end
      authenticate_esp_header_if_needed options, iv, icv
      private_decrypt opt
    end
def decrypt! ( cipher , options = { } ) opt = { salt : '' , parse : true } . merge ( options ) set_crypto cipher , opt [ :intmode ] iv = compute_iv_for_decrypting ( opt [ :salt ] , self [ :body ] ) if authenticated? && ( @icv_length . zero? || opt [ :icv_length ] ) check_icv_length ( opt ) decrypt_format_packet end authenticate_esp_header_if_needed options , iv , icv private_decrypt opt end
Decrypt in-place ESP payload and trailer.
Decrypt in - place ESP payload and trailer .
+true+ if ESP packet is authenticated
+ true + if ESP packet is authenticated
Boolean
cipher
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