File: aes128_gcm.rb

package info (click to toggle)
ruby-net-ssh 1%3A7.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,804 kB
  • sloc: ruby: 16,999; makefile: 5
file content (40 lines) | stat: -rw-r--r-- 717 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require 'net/ssh/transport/hmac/abstract'
require 'net/ssh/transport/gcm_cipher'

module Net::SSH::Transport
  ## Implements the aes128-gcm@openssh cipher
  class AES128_GCM
    extend ::Net::SSH::Transport::GCMCipher

    ## Implicit HMAC, do need to do anything
    class ImplicitHMac < ::Net::SSH::Transport::HMAC::Abstract
      def aead
        true
      end

      def key_length
        16
      end
    end

    def implicit_mac
      ImplicitHMac.new
    end

    def algo_name
      'aes-128-gcm'
    end

    def name
      'aes128-gcm@openssh.com'
    end

    #
    # --- RFC 5647 ---
    # K_LEN       AES key length                   16 octets
    #
    def self.key_length
      16
    end
  end
end