lib/packetgen/plugin/ike/sk.rb
# Decrypt 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 [Hash] options
# @option options [Boolean] :parse parse deciphered payload to retrieve
#   Plugins (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 [OpenSSL::HMAC] :intmode integrity mode to use with a
#   confidentiality-only cipher. Only HMAC are supported.
# @return [Boolean] +true+ if SK payload is authenticated
Decrypt in-place SK payload.
Decrypt in - place SK payload .
def decrypt!(cipher, options={})
        opt = { salt: '', parse: true }.merge!(options)
        set_crypto cipher, opt[:intmode]
        iv = compute_iv_for_decrypting(force_binary(opt[:salt]), self[:content])
        if authenticated?
          if @icv_length.zero?
            @icv_length = opt[:icv_length].to_i if opt[:icv_length]
            raise PacketGen::ParseError, 'unknown ICV size' if @icv_length.zero?
          end
          icv = self[:content].slice!(-@icv_length, @icv_length)
        end
        authenticate_if_needed 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 ( force_binary ( opt [ :salt ] ) , self [ :content ] ) if authenticated? if @icv_length . zero? @icv_length = opt [ :icv_length ] . to_i if opt [ :icv_length ] raise PacketGen :: ParseError , 'unknown ICV size' if @icv_length . zero? end icv = self [ :content ] . slice! ( - @icv_length , @icv_length ) end authenticate_if_needed iv , icv private_decrypt opt end
Decrypt in-place SK payload.
Decrypt in - place SK payload .
+true+ if SK payload is authenticated
+ true + if SK payload 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