File: identity_cipher.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 (65 lines) | stat: -rw-r--r-- 1,362 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
module Net
  module SSH
    module Transport
      # A cipher that does nothing but pass the data through, unchanged. This
      # keeps things in the code nice and clean when a cipher has not yet been
      # determined (i.e., during key exchange).
      class IdentityCipher
        class << self
          # A default block size of 8 is required by the SSH2 protocol.
          def block_size
            8
          end

          def key_length
            0
          end

          # Returns an arbitrary integer.
          def iv_len
            4
          end

          # Does nothing. Returns self.
          def encrypt
            self
          end

          # Does nothing. Returns self.
          def decrypt
            self
          end

          # Passes its single argument through unchanged.
          def update(text)
            text
          end

          # Returns the empty string.
          def final
            ""
          end

          # The name of this cipher, which is "identity".
          def name
            "identity"
          end

          # Does nothing. Returns nil.
          def iv=(v)
            nil
          end

          # Does nothing. Returns self.
          def reset
            self
          end

          def implicit_mac?
            false
          end
        end
      end
    end
  end
end