lib/packetgen/plugin/ike/sk.rb
def encrypt!(cipher, iv, options={}) # rubocop:disable Naming/MethodParameterName
        opt = { salt: '' }.merge!(options)

        set_crypto cipher, opt[:intmode]
        compute_iv_for_encrypting iv, opt[:salt]

        authenticate_if_needed iv
        encrypted_msg = encrypt_body(iv, opt)
        encrypted_msg << generate_auth_tag(opt) if authenticated?
        self[:content].read(iv + encrypted_msg)

        # Remove plain payloads
        self[:body] = PacketGen::Types::String.new

        remove_enciphered_packets
        self.calc_length
        self
      end
# Encrypt in-place SK payload.
# @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 IV to encipher SK payload content
#   * CTR and GCM modes: +iv+ is 8-bytes long.
# @param [Hash] options
# @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] :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 SK payload.
Encrypt in - place SK payload .
def encrypt!(cipher, iv, options={}) 
        opt = { salt: '' }.merge!(options)
        set_crypto cipher, opt[:intmode]
        compute_iv_for_encrypting iv, opt[:salt]
        authenticate_if_needed iv
        encrypted_msg = encrypt_body(iv, opt)
        encrypted_msg << generate_auth_tag(opt) if authenticated?
        self[:content].read(iv + encrypted_msg)
        self[:body] = PacketGen::Types::String.new
        remove_enciphered_packets
        self.calc_length
        self
      end
def encrypt! ( cipher , iv , options = { } ) opt = { salt : '' } . merge! ( options ) set_crypto cipher , opt [ :intmode ] compute_iv_for_encrypting iv , opt [ :salt ] authenticate_if_needed iv encrypted_msg = encrypt_body ( iv , opt ) encrypted_msg << generate_auth_tag ( opt ) if authenticated? self [ :content ] . read ( iv + encrypted_msg ) self [ :body ] = PacketGen :: Types :: String . new remove_enciphered_packets self . calc_length self end
Encrypt in-place SK payload.
Encrypt in - place SK payload .
# rubocop:disable Naming/MethodParameterName # Remove plain payloads
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