net-ssh 3.2.0.rc2 → 7.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +2 -2
- data/.dockerignore +6 -0
- data/.github/config/rubocop_linter_action.yml +4 -0
- data/.github/workflows/ci-with-docker.yml +44 -0
- data/.github/workflows/ci.yml +87 -0
- data/.github/workflows/rubocop.yml +16 -0
- data/.gitignore +13 -0
- data/.rubocop.yml +22 -0
- data/.rubocop_todo.yml +1081 -0
- data/CHANGES.txt +228 -7
- data/Dockerfile +27 -0
- data/Dockerfile.openssl3 +17 -0
- data/Gemfile +13 -0
- data/Gemfile.noed25519 +12 -0
- data/ISSUE_TEMPLATE.md +30 -0
- data/Manifest +4 -5
- data/README.md +297 -0
- data/Rakefile +125 -74
- data/SECURITY.md +4 -0
- data/appveyor.yml +58 -0
- data/docker-compose.yml +23 -0
- data/lib/net/ssh/authentication/agent.rb +279 -18
- data/lib/net/ssh/authentication/certificate.rb +183 -0
- data/lib/net/ssh/authentication/constants.rb +17 -15
- data/lib/net/ssh/authentication/ed25519.rb +186 -0
- data/lib/net/ssh/authentication/ed25519_loader.rb +31 -0
- data/lib/net/ssh/authentication/key_manager.rb +86 -39
- data/lib/net/ssh/authentication/methods/abstract.rb +67 -48
- data/lib/net/ssh/authentication/methods/hostbased.rb +34 -37
- data/lib/net/ssh/authentication/methods/keyboard_interactive.rb +13 -13
- data/lib/net/ssh/authentication/methods/none.rb +16 -19
- data/lib/net/ssh/authentication/methods/password.rb +27 -17
- data/lib/net/ssh/authentication/methods/publickey.rb +96 -55
- data/lib/net/ssh/authentication/pageant.rb +471 -367
- data/lib/net/ssh/authentication/pub_key_fingerprint.rb +43 -0
- data/lib/net/ssh/authentication/session.rb +131 -121
- data/lib/net/ssh/buffer.rb +399 -300
- data/lib/net/ssh/buffered_io.rb +154 -150
- data/lib/net/ssh/config.rb +308 -185
- data/lib/net/ssh/connection/channel.rb +635 -613
- data/lib/net/ssh/connection/constants.rb +29 -29
- data/lib/net/ssh/connection/event_loop.rb +123 -0
- data/lib/net/ssh/connection/keepalive.rb +55 -51
- data/lib/net/ssh/connection/session.rb +620 -551
- data/lib/net/ssh/connection/term.rb +125 -123
- data/lib/net/ssh/errors.rb +101 -99
- data/lib/net/ssh/key_factory.rb +197 -105
- data/lib/net/ssh/known_hosts.rb +214 -127
- data/lib/net/ssh/loggable.rb +50 -49
- data/lib/net/ssh/packet.rb +83 -79
- data/lib/net/ssh/prompt.rb +50 -81
- data/lib/net/ssh/proxy/command.rb +105 -90
- data/lib/net/ssh/proxy/errors.rb +12 -10
- data/lib/net/ssh/proxy/http.rb +82 -79
- data/lib/net/ssh/proxy/https.rb +50 -0
- data/lib/net/ssh/proxy/jump.rb +54 -0
- data/lib/net/ssh/proxy/socks4.rb +2 -6
- data/lib/net/ssh/proxy/socks5.rb +14 -17
- data/lib/net/ssh/service/forward.rb +370 -317
- data/lib/net/ssh/test/channel.rb +145 -136
- data/lib/net/ssh/test/extensions.rb +131 -110
- data/lib/net/ssh/test/kex.rb +34 -32
- data/lib/net/ssh/test/local_packet.rb +46 -44
- data/lib/net/ssh/test/packet.rb +89 -70
- data/lib/net/ssh/test/remote_packet.rb +32 -30
- data/lib/net/ssh/test/script.rb +156 -142
- data/lib/net/ssh/test/socket.rb +49 -48
- data/lib/net/ssh/test.rb +82 -77
- data/lib/net/ssh/transport/algorithms.rb +441 -360
- data/lib/net/ssh/transport/cipher_factory.rb +96 -98
- data/lib/net/ssh/transport/constants.rb +32 -24
- data/lib/net/ssh/transport/ctr.rb +42 -22
- data/lib/net/ssh/transport/hmac/abstract.rb +81 -63
- data/lib/net/ssh/transport/hmac/md5.rb +0 -2
- data/lib/net/ssh/transport/hmac/md5_96.rb +0 -2
- data/lib/net/ssh/transport/hmac/none.rb +0 -2
- data/lib/net/ssh/transport/hmac/ripemd160.rb +0 -2
- data/lib/net/ssh/transport/hmac/sha1.rb +0 -2
- data/lib/net/ssh/transport/hmac/sha1_96.rb +0 -2
- data/lib/net/ssh/transport/hmac/sha2_256.rb +7 -11
- data/lib/net/ssh/transport/hmac/sha2_256_96.rb +4 -8
- data/lib/net/ssh/transport/hmac/sha2_256_etm.rb +12 -0
- data/lib/net/ssh/transport/hmac/sha2_512.rb +6 -9
- data/lib/net/ssh/transport/hmac/sha2_512_96.rb +4 -8
- data/lib/net/ssh/transport/hmac/sha2_512_etm.rb +12 -0
- data/lib/net/ssh/transport/hmac.rb +14 -12
- data/lib/net/ssh/transport/identity_cipher.rb +54 -52
- data/lib/net/ssh/transport/kex/abstract.rb +130 -0
- data/lib/net/ssh/transport/kex/abstract5656.rb +72 -0
- data/lib/net/ssh/transport/kex/curve25519_sha256.rb +39 -0
- data/lib/net/ssh/transport/kex/curve25519_sha256_loader.rb +30 -0
- data/lib/net/ssh/transport/kex/diffie_hellman_group14_sha1.rb +33 -40
- data/lib/net/ssh/transport/kex/diffie_hellman_group14_sha256.rb +11 -0
- data/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb +119 -213
- data/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb +53 -61
- data/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha256.rb +5 -9
- data/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb +36 -90
- data/lib/net/ssh/transport/kex/ecdh_sha2_nistp384.rb +18 -10
- data/lib/net/ssh/transport/kex/ecdh_sha2_nistp521.rb +18 -10
- data/lib/net/ssh/transport/kex.rb +15 -12
- data/lib/net/ssh/transport/key_expander.rb +24 -20
- data/lib/net/ssh/transport/openssl.rb +161 -124
- data/lib/net/ssh/transport/packet_stream.rb +225 -185
- data/lib/net/ssh/transport/server_version.rb +55 -56
- data/lib/net/ssh/transport/session.rb +306 -255
- data/lib/net/ssh/transport/state.rb +178 -176
- data/lib/net/ssh/verifiers/accept_new.rb +33 -0
- data/lib/net/ssh/verifiers/accept_new_or_local_tunnel.rb +33 -0
- data/lib/net/ssh/verifiers/always.rb +58 -0
- data/lib/net/ssh/verifiers/never.rb +19 -0
- data/lib/net/ssh/version.rb +55 -53
- data/lib/net/ssh.rb +110 -47
- data/net-ssh-public_cert.pem +18 -18
- data/net-ssh.gemspec +36 -205
- data/support/ssh_tunnel_bug.rb +5 -5
- data.tar.gz.sig +0 -0
- metadata +153 -118
- metadata.gz.sig +0 -0
- data/.travis.yml +0 -18
- data/README.rdoc +0 -182
- data/lib/net/ssh/authentication/agent/java_pageant.rb +0 -85
- data/lib/net/ssh/authentication/agent/socket.rb +0 -178
- data/lib/net/ssh/ruby_compat.rb +0 -46
- data/lib/net/ssh/verifiers/lenient.rb +0 -30
- data/lib/net/ssh/verifiers/null.rb +0 -12
- data/lib/net/ssh/verifiers/secure.rb +0 -52
- data/lib/net/ssh/verifiers/strict.rb +0 -24
- data/setup.rb +0 -1585
- data/support/arcfour_check.rb +0 -20
- data/test/README.txt +0 -18
- data/test/authentication/methods/common.rb +0 -28
- data/test/authentication/methods/test_abstract.rb +0 -51
- data/test/authentication/methods/test_hostbased.rb +0 -114
- data/test/authentication/methods/test_keyboard_interactive.rb +0 -121
- data/test/authentication/methods/test_none.rb +0 -41
- data/test/authentication/methods/test_password.rb +0 -95
- data/test/authentication/methods/test_publickey.rb +0 -148
- data/test/authentication/test_agent.rb +0 -232
- data/test/authentication/test_key_manager.rb +0 -240
- data/test/authentication/test_session.rb +0 -107
- data/test/common.rb +0 -125
- data/test/configs/auth_off +0 -5
- data/test/configs/auth_on +0 -4
- data/test/configs/empty +0 -0
- data/test/configs/eqsign +0 -3
- data/test/configs/exact_match +0 -8
- data/test/configs/host_plus +0 -10
- data/test/configs/multihost +0 -4
- data/test/configs/negative_match +0 -6
- data/test/configs/nohost +0 -19
- data/test/configs/numeric_host +0 -4
- data/test/configs/proxy_remote_user +0 -2
- data/test/configs/send_env +0 -2
- data/test/configs/substitutes +0 -8
- data/test/configs/wild_cards +0 -14
- data/test/connection/test_channel.rb +0 -487
- data/test/connection/test_session.rb +0 -564
- data/test/integration/README.txt +0 -17
- data/test/integration/Vagrantfile +0 -12
- data/test/integration/common.rb +0 -63
- data/test/integration/playbook.yml +0 -56
- data/test/integration/test_forward.rb +0 -637
- data/test/integration/test_id_rsa_keys.rb +0 -96
- data/test/integration/test_proxy.rb +0 -93
- data/test/known_hosts/github +0 -1
- data/test/known_hosts/github_hash +0 -1
- data/test/manual/test_pageant.rb +0 -37
- data/test/start/test_connection.rb +0 -53
- data/test/start/test_options.rb +0 -57
- data/test/start/test_transport.rb +0 -28
- data/test/start/test_user_nil.rb +0 -27
- data/test/test_all.rb +0 -12
- data/test/test_buffer.rb +0 -433
- data/test/test_buffered_io.rb +0 -63
- data/test/test_config.rb +0 -268
- data/test/test_key_factory.rb +0 -191
- data/test/test_known_hosts.rb +0 -66
- data/test/transport/hmac/test_md5.rb +0 -41
- data/test/transport/hmac/test_md5_96.rb +0 -27
- data/test/transport/hmac/test_none.rb +0 -34
- data/test/transport/hmac/test_ripemd160.rb +0 -36
- data/test/transport/hmac/test_sha1.rb +0 -36
- data/test/transport/hmac/test_sha1_96.rb +0 -27
- data/test/transport/hmac/test_sha2_256.rb +0 -37
- data/test/transport/hmac/test_sha2_256_96.rb +0 -27
- data/test/transport/hmac/test_sha2_512.rb +0 -37
- data/test/transport/hmac/test_sha2_512_96.rb +0 -27
- data/test/transport/kex/test_diffie_hellman_group14_sha1.rb +0 -13
- data/test/transport/kex/test_diffie_hellman_group1_sha1.rb +0 -150
- data/test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb +0 -96
- data/test/transport/kex/test_diffie_hellman_group_exchange_sha256.rb +0 -19
- data/test/transport/kex/test_ecdh_sha2_nistp256.rb +0 -161
- data/test/transport/kex/test_ecdh_sha2_nistp384.rb +0 -38
- data/test/transport/kex/test_ecdh_sha2_nistp521.rb +0 -38
- data/test/transport/test_algorithms.rb +0 -328
- data/test/transport/test_cipher_factory.rb +0 -443
- data/test/transport/test_hmac.rb +0 -34
- data/test/transport/test_identity_cipher.rb +0 -40
- data/test/transport/test_packet_stream.rb +0 -1762
- data/test/transport/test_server_version.rb +0 -74
- data/test/transport/test_session.rb +0 -331
- data/test/transport/test_state.rb +0 -181
- data/test/verifiers/test_secure.rb +0 -40
@@ -1,443 +0,0 @@
|
|
1
|
-
# encoding: ASCII-8BIT
|
2
|
-
|
3
|
-
require 'common'
|
4
|
-
require 'net/ssh/transport/cipher_factory'
|
5
|
-
|
6
|
-
module Transport
|
7
|
-
|
8
|
-
class TestCipherFactory < Test::Unit::TestCase
|
9
|
-
def self.if_supported?(name)
|
10
|
-
yield if Net::SSH::Transport::CipherFactory.supported?(name)
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_lengths_for_none
|
14
|
-
assert_equal [0,0], factory.get_lengths("none")
|
15
|
-
assert_equal [0,0], factory.get_lengths("bogus")
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_lengths_for_blowfish_cbc
|
19
|
-
assert_equal [16,8], factory.get_lengths("blowfish-cbc")
|
20
|
-
end
|
21
|
-
|
22
|
-
if_supported?("idea-cbc") do
|
23
|
-
def test_lengths_for_idea_cbc
|
24
|
-
assert_equal [16,8], factory.get_lengths("idea-cbc")
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_lengths_for_rijndael_cbc
|
29
|
-
assert_equal [32,16], factory.get_lengths("rijndael-cbc@lysator.liu.se")
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_lengths_for_cast128_cbc
|
33
|
-
assert_equal [16,8], factory.get_lengths("cast128-cbc")
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_lengths_for_3des_cbc
|
37
|
-
assert_equal [24,8], factory.get_lengths("3des-cbc")
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_lengths_for_aes128_cbc
|
41
|
-
assert_equal [16,16], factory.get_lengths("aes128-cbc")
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_lengths_for_aes192_cbc
|
45
|
-
assert_equal [24,16], factory.get_lengths("aes192-cbc")
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_lengths_for_aes256_cbc
|
49
|
-
assert_equal [32,16], factory.get_lengths("aes256-cbc")
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_lengths_for_arcfour
|
53
|
-
assert_equal [16,8], factory.get_lengths("arcfour")
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_lengths_for_arcfour128
|
57
|
-
assert_equal [16,8], factory.get_lengths("arcfour128")
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_lengths_for_arcfour256
|
61
|
-
assert_equal [32,8], factory.get_lengths("arcfour256")
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_lengths_for_arcfour512
|
65
|
-
assert_equal [64,8], factory.get_lengths("arcfour512")
|
66
|
-
end
|
67
|
-
|
68
|
-
if_supported?("camellia128-cbc@openssh.org") do
|
69
|
-
def test_lengths_for_camellia128_cbc_openssh_org
|
70
|
-
assert_equal [16,16], factory.get_lengths("camellia128-cbc@openssh.org")
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
if_supported?("camellia192-cbc@openssh.org") do
|
75
|
-
def test_lengths_for_camellia192_cbc_openssh_org
|
76
|
-
assert_equal [24,16], factory.get_lengths("camellia192-cbc@openssh.org")
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
if_supported?("camellia256-cbc@openssh.org") do
|
81
|
-
def test_lengths_for_camellia256_cbc_openssh_org
|
82
|
-
assert_equal [32,16], factory.get_lengths("camellia256-cbc@openssh.org")
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_lengths_for_3des_ctr
|
87
|
-
assert_equal [24,8], factory.get_lengths("3des-ctr")
|
88
|
-
end
|
89
|
-
|
90
|
-
def test_lengths_for_aes128_ctr
|
91
|
-
assert_equal [16,16], factory.get_lengths("aes128-ctr")
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_lengths_for_aes192_ctr
|
95
|
-
assert_equal [24,16], factory.get_lengths("aes192-ctr")
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_lengths_for_aes256_ctr
|
99
|
-
assert_equal [32,16], factory.get_lengths("aes256-ctr")
|
100
|
-
end
|
101
|
-
|
102
|
-
def test_lengths_for_blowfish_ctr
|
103
|
-
assert_equal [16,8], factory.get_lengths("blowfish-ctr")
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_lengths_for_cast128_ctr
|
107
|
-
assert_equal [16,8], factory.get_lengths("cast128-ctr")
|
108
|
-
end
|
109
|
-
|
110
|
-
if_supported?("camellia128-ctr@openssh.org") do
|
111
|
-
def test_lengths_for_camellia128_ctr_openssh_org
|
112
|
-
assert_equal [16,16], factory.get_lengths("camellia128-ctr@openssh.org")
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
if_supported?("camellia192-ctr@openssh.org") do
|
117
|
-
def test_lengths_for_camellia192_ctr_openssh_org
|
118
|
-
assert_equal [24,16], factory.get_lengths("camellia192-ctr@openssh.org")
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
if_supported?("camellia256-ctr@openssh.org") do
|
123
|
-
def test_lengths_for_camellia256_ctr_openssh_org
|
124
|
-
assert_equal [32,16], factory.get_lengths("camellia256-ctr@openssh.org")
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
BLOWFISH_CBC = "\210\021\200\315\240_\026$\352\204g\233\244\242x\332e\370\001\327\224Nv@9_\323\037\252kb\037\036\237\375]\343/y\037\237\312Q\f7]\347Y\005\275%\377\0010$G\272\250B\265Nd\375\342\372\025r6}+Y\213y\n\237\267\\\374^\346BdJ$\353\220Ik\023<\236&H\277=\225"
|
129
|
-
|
130
|
-
def test_blowfish_cbc_for_encryption
|
131
|
-
assert_equal BLOWFISH_CBC, encrypt("blowfish-cbc")
|
132
|
-
end
|
133
|
-
|
134
|
-
def test_blowfish_cbc_for_decryption
|
135
|
-
assert_equal TEXT, decrypt("blowfish-cbc", BLOWFISH_CBC)
|
136
|
-
end
|
137
|
-
|
138
|
-
if_supported?("idea-cbc") do
|
139
|
-
IDEA_CBC = "W\234\017G\231\b\357\370H\b\256U]\343M\031k\233]~\023C\363\263\177\262-\261\341$\022\376mv\217\322\b\2763\270H\306\035\343z\313\312\3531\351\t\201\302U\022\360\300\354ul7$z\320O]\360g\024\305\005`V\005\335A\351\312\270c\320D\232\eQH1\340\265\2118\031g*\303v"
|
140
|
-
|
141
|
-
def test_idea_cbc_for_encryption
|
142
|
-
assert_equal IDEA_CBC, encrypt("idea-cbc")
|
143
|
-
end
|
144
|
-
|
145
|
-
def test_idea_cbc_for_decryption
|
146
|
-
assert_equal TEXT, decrypt("idea-cbc", IDEA_CBC)
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
RIJNDAEL = "$\253\271\255\005Z\354\336&\312\324\221\233\307Mj\315\360\310Fk\241EfN\037\231\213\361{'\310\204\347I\343\271\005\240`\325;\034\346uM>#\241\231C`\374\261\vo\226;Z\302:\b\250\366T\330\\#V\330\340\226\363\374!\bm\266\232\207!\232\347\340\t\307\370\356z\236\343=v\210\206y"
|
151
|
-
|
152
|
-
def test_rijndael_cbc_for_encryption
|
153
|
-
assert_equal RIJNDAEL, encrypt("rijndael-cbc@lysator.liu.se")
|
154
|
-
end
|
155
|
-
|
156
|
-
def test_rijndael_cbc_for_decryption
|
157
|
-
assert_equal TEXT, decrypt("rijndael-cbc@lysator.liu.se", RIJNDAEL)
|
158
|
-
end
|
159
|
-
|
160
|
-
CAST128_CBC = "qW\302\331\333P\223t[9 ~(sg\322\271\227\272\022I\223\373p\255>k\326\314\260\2003\236C_W\211\227\373\205>\351\334\322\227\223\e\236\202Ii\032!P\214\035:\017\360h7D\371v\210\264\317\236a\262w1\2772\023\036\331\227\240:\f/X\351\324I\t[x\350\323E\2301\016m"
|
161
|
-
|
162
|
-
def test_cast128_cbc_for_encryption
|
163
|
-
assert_equal CAST128_CBC, encrypt("cast128-cbc")
|
164
|
-
end
|
165
|
-
|
166
|
-
def test_cast128_cbc_for_decryption
|
167
|
-
assert_equal TEXT, decrypt("cast128-cbc", CAST128_CBC)
|
168
|
-
end
|
169
|
-
|
170
|
-
TRIPLE_DES_CBC = "\322\252\216D\303Q\375gg\367A{\177\313\3436\272\353%\223K?\257\206|\r&\353/%\340\336 \203E8rY\206\234\004\274\267\031\233T/{\"\227/B!i?[qGaw\306T\206\223\213n \212\032\244%]@\355\250\334\312\265E\251\017\361\270\357\230\274KP&^\031r+r%\370"
|
171
|
-
|
172
|
-
def test_3des_cbc_for_encryption
|
173
|
-
assert_equal TRIPLE_DES_CBC, encrypt("3des-cbc")
|
174
|
-
end
|
175
|
-
|
176
|
-
def test_3des_cbc_for_decryption
|
177
|
-
assert_equal TEXT, decrypt("3des-cbc", TRIPLE_DES_CBC)
|
178
|
-
end
|
179
|
-
|
180
|
-
AES128_CBC = "k\026\350B\366-k\224\313\3277}B\035\004\200\035\r\233\024$\205\261\231Q\2214r\245\250\360\315\237\266hg\262C&+\321\346Pf\267v\376I\215P\327\345-\232&HK\375\326_\030<\a\276\212\303g\342C\242O\233\260\006\001a&V\345`\\T\e\236.\207\223l\233ri^\v\252\363\245"
|
181
|
-
|
182
|
-
def test_aes128_cbc_for_encryption
|
183
|
-
assert_equal AES128_CBC, encrypt("aes128-cbc")
|
184
|
-
end
|
185
|
-
|
186
|
-
def test_aes128_cbc_for_decryption
|
187
|
-
assert_equal TEXT, decrypt("aes128-cbc", AES128_CBC)
|
188
|
-
end
|
189
|
-
|
190
|
-
AES192_CBC = "\256\017)x\270\213\336\303L\003f\235'jQ\3231k9\225\267\242\364C4\370\224\201\302~\217I\202\374\2167='\272\037\225\223\177Y\r\212\376(\275\n\3553\377\177\252C\254\236\016MA\274Z@H\331<\rL\317\205\323[\305X8\376\237=\374\352bH9\244\0231\353\204\352p\226\326~J\242"
|
191
|
-
|
192
|
-
def test_aes192_cbc_for_encryption
|
193
|
-
assert_equal AES192_CBC, encrypt("aes192-cbc")
|
194
|
-
end
|
195
|
-
|
196
|
-
def test_aes192_cbc_for_decryption
|
197
|
-
assert_equal TEXT, decrypt("aes192-cbc", AES192_CBC)
|
198
|
-
end
|
199
|
-
|
200
|
-
AES256_CBC = "$\253\271\255\005Z\354\336&\312\324\221\233\307Mj\315\360\310Fk\241EfN\037\231\213\361{'\310\204\347I\343\271\005\240`\325;\034\346uM>#\241\231C`\374\261\vo\226;Z\302:\b\250\366T\330\\#V\330\340\226\363\374!\bm\266\232\207!\232\347\340\t\307\370\356z\236\343=v\210\206y"
|
201
|
-
|
202
|
-
def test_aes256_cbc_for_encryption
|
203
|
-
assert_equal AES256_CBC, encrypt("aes256-cbc")
|
204
|
-
end
|
205
|
-
|
206
|
-
def test_aes256_cbc_for_decryption
|
207
|
-
assert_equal TEXT, decrypt("aes256-cbc", AES256_CBC)
|
208
|
-
end
|
209
|
-
|
210
|
-
ARCFOUR = "\xC1.\x1AdH\xD0+%\xF1CrG\x1C\xCC\xF6\xACho\xB0\x95\\\xBC\x02P\xF9\xAF\n\xBB<\x13\xF3\xCF\xEB\n\b(iO\xFB'\t^?\xA6\xE5a\xE2\x17\f\x97\xCAs\x9E\xFC\xF2\x88\xC93\v\x84\xCA\x82\x0E\x1D\x11\xEA\xE1\x82\x8E\xB3*\xC5\xFB\x8Cmgs\xB0\xFA\xF5\x9C\\\xE2\xB0\x95\x1F>LT"
|
211
|
-
|
212
|
-
def test_arcfour_for_encryption
|
213
|
-
assert_equal ARCFOUR, encrypt("arcfour")
|
214
|
-
end
|
215
|
-
|
216
|
-
def test_arcfour_for_decryption
|
217
|
-
assert_equal TEXT, decrypt("arcfour", ARCFOUR)
|
218
|
-
end
|
219
|
-
|
220
|
-
ARCFOUR128 = "\n\x90\xED*\xD4\xBE\xCBg5\xA5\a\xEC]\x97\xB7L\x06)6\x12FL\x90@\xF4Sqxqh\r\x11\x1Aq \xC8\xE6v\xC6\x12\xD9<A\xDAZ\xFE\x7F\x88\x19f.\x06\xA7\xFE:\xFF\x93\x9B\x8D\xA0\\\x9E\xCA\x03\x15\xE1\xE2\f\xC0\b\xA2C\xE1\xBD\xB6\x13D\xD1\xB4'g\x89\xDC\xEB\f\x19Z)U"
|
221
|
-
|
222
|
-
def test_arcfour128_for_encryption
|
223
|
-
assert_equal ARCFOUR128, encrypt("arcfour128")
|
224
|
-
end
|
225
|
-
|
226
|
-
def test_arcfour128_for_decryption
|
227
|
-
assert_equal TEXT, decrypt("arcfour128", ARCFOUR128)
|
228
|
-
end
|
229
|
-
|
230
|
-
ARCFOUR256 = "|g\xCCw\xF5\xC1y\xEB\xF0\v\xF7\x83\x14\x03\xC8\xAB\xE8\xC2\xFCY\xDC,\xB8\xD4dVa\x8B\x18%\xA4S\x00\xE0at\x86\xE8\xA6W\xAB\xD2\x9D\xA8\xDE[g\aZy.\xFB\xFC\x82c\x04h\f\xBFYq\xB7U\x80\x0EG\x91\x88\xDF\xA3\xA2\xFA(\xEC\xDB\xA4\xE7\xFE)\x12u\xAF\x0EZ\xA0\xBA\x97\n\xFC"
|
231
|
-
|
232
|
-
def test_arcfour256_for_encryption
|
233
|
-
assert_equal ARCFOUR256, encrypt("arcfour256")
|
234
|
-
end
|
235
|
-
|
236
|
-
def test_arcfour256_for_decryption
|
237
|
-
assert_equal TEXT, decrypt("arcfour256", ARCFOUR256)
|
238
|
-
end
|
239
|
-
|
240
|
-
ARCFOUR512 = "|8\"v\xE7\xE3\b\xA8\x19\x9Aa\xB6Vv\x00\x11\x8A$C\xB6xE\xEF\xF1j\x90\xA8\xFA\x10\xE4\xA1b8\xF6\x04\xF2+\xC0\xD1(8\xEBT]\xB0\xF3/\xD9\xE0@\x83\a\x93\x9D\xCA\x04RXS\xB7A\x0Fj\x94\bE\xEB\x84j\xB4\xDF\nU\xF7\x83o\n\xE8\xF9\x01{jH\xEE\xCDQym\x9E"
|
241
|
-
|
242
|
-
def test_arcfour512_for_encryption
|
243
|
-
assert_equal ARCFOUR512, encrypt("arcfour512")
|
244
|
-
end
|
245
|
-
|
246
|
-
def test_arcfour512_for_decryption
|
247
|
-
assert_equal TEXT, decrypt("arcfour512", ARCFOUR512)
|
248
|
-
end
|
249
|
-
|
250
|
-
if_supported?("camellia128-cbc@openssh.org") do
|
251
|
-
CAMELLIA128_CBC = "\a\b\x83+\xF1\xC5m\a\xE1\xD3\x06\xD2NA\xC3l@\\*M\xFD\x96\xAE\xA8\xB4\xA9\xACm\"8\x8E\xEE<\xC3O[\rK\xFAgu}\xCD\xAC\xF4\x04o\xDB\x94-\xB8\"\xDC\xE7{y\xA9 \x8F=y\x85\x82v\xC8\xCA\x8A\xE9\xE3:\xC4,u=a/\xC0\x05\xDA\xDAk8g\xCB\xD9\xA8\xE6\xFE\xCE_\x8E\x97\xF0\xAC\xB6\xCE"
|
252
|
-
def test_camellia128_cbc_for_encryption
|
253
|
-
assert_equal CAMELLIA128_CBC, encrypt("camellia128-cbc@openssh.org")
|
254
|
-
end
|
255
|
-
def test_camellia128_cbc_for_decryption
|
256
|
-
assert_equal TEXT, decrypt("camellia128-cbc@openssh.org", CAMELLIA128_CBC)
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
|
-
if_supported?("camellia192-cbc@openssh.org") do
|
261
|
-
CAMELLIA192_CBC = "\x82\xB2\x03\x90\xFA\f2\xA0\xE3\xFA\xF2B\xAB\xDBX\xD5\x04z\xD4G\x19\xB8\xAB\v\x85\x84\xCD:.\xBA\x9Dd\xD5(\xEB.\n\xAA]\xCB\xF3\x0F4\x8Bd\xF8m\xC9!\xE2\xA1=\xEBY\xA6\x83\x86\n\x13\e6\v\x06\xBBNJg\xF2-\x14',[\xC1\xB1.\x85\xF3\xC6\xBF\x1Ff\xCE\x87'\x9C\xB2\xC8!\xF3|\xE2\xD2\x9E\x96\xA1"
|
262
|
-
def test_camellia192_cbc_for_encryption
|
263
|
-
assert_equal CAMELLIA192_CBC, encrypt("camellia192-cbc@openssh.org")
|
264
|
-
end
|
265
|
-
def test_camellia192_cbc_for_decryption
|
266
|
-
assert_equal TEXT, decrypt("camellia192-cbc@openssh.org", CAMELLIA192_CBC)
|
267
|
-
end
|
268
|
-
end
|
269
|
-
|
270
|
-
if_supported?("camellia256-cbc@openssh.org") do
|
271
|
-
CAMELLIA256_CBC = ",\x80J/\xF5\x8F\xFE4\xF0@\n[2\xFF4\xB6\xA4\xD0\xF8\xF5*\x17I\xF3\xA2\x1F$L\xC6\xA1\x06\xDC\x84f\x1C\x10&\x1C\xC4/R\x859|i\x85ZP\xC8\x94\xED\xE8-\n@ w\x92\xF7\xD4\xAB\xF0\x85c\xC1\x0F\x1E#\xEB\xE5W\x87N!\xC7'/\xE3E8$\x1D\x9B:\xC9\xAF_\x05\xAC%\xD7\x945\xBBDK"
|
272
|
-
def test_camellia256_cbc_for_encryption
|
273
|
-
assert_equal CAMELLIA256_CBC, encrypt("camellia256-cbc@openssh.org")
|
274
|
-
end
|
275
|
-
def test_camellia256_cbc_for_decryption
|
276
|
-
assert_equal TEXT, decrypt("camellia256-cbc@openssh.org", CAMELLIA256_CBC)
|
277
|
-
end
|
278
|
-
end
|
279
|
-
|
280
|
-
BLOWFISH_CTR = "\xF5\xA6\x1E{\x8F(\x85G\xFAh\xDB\x19\xDC\xDF\xA2\x9A\x99\xDD5\xFF\xEE\x8BE\xE6\xB5\x92\x82\xE80\x91\x11`\xEF\x10\xED\xE9\xD3\vG\x0E\xAF\xB2K\t\xA4\xA6\x05\xD1\x17\x0Fl\r@E\x8DJ\e\xE63\x04\xB5\x05\x99Y\xCC\xFBb\x8FK+\x8C1v\xE4N\b?B\x06Rz\xA6\xB6N/b\xCE}\x83\x8DY\xD7\x92qU\x0F"
|
281
|
-
|
282
|
-
def test_blowfish_ctr_for_encryption
|
283
|
-
assert_equal BLOWFISH_CTR, encrypt("blowfish-ctr")
|
284
|
-
end
|
285
|
-
|
286
|
-
def test_blowfish_ctr_for_decryption
|
287
|
-
assert_equal TEXT, decrypt("blowfish-ctr", BLOWFISH_CTR)
|
288
|
-
end
|
289
|
-
|
290
|
-
CAST128_CTR = "\xB5\xBB\xC3h\x80\x90`{\xD7I\x03\xE9\x80\xC4\xC4U\xE3@\xF1\xE9\xEFX\xDB6\xEE,\x8E\xC2\xE8\x89\x17\xBArf\x81\r\x96\xDC\xB1_'\x83hs\t7\xB8@\x17\xAA\xD9;\xE8\x8E\x94\xBD\xFF\xA4K\xA4\xFA\x8F-\xCD\bO\xD9I`\xE5\xC9H\x99\x14\xC5K\xC8\xEF\xEA#\x1D\xE5\x13O\xE1^P\xDC\x1C^qm\v|c@"
|
291
|
-
|
292
|
-
def test_cast128_ctr_for_encryption
|
293
|
-
assert_equal CAST128_CTR, encrypt("cast128-ctr")
|
294
|
-
end
|
295
|
-
|
296
|
-
def test_cast128_ctr_for_decryption
|
297
|
-
assert_equal TEXT, decrypt("cast128-ctr", CAST128_CTR)
|
298
|
-
end
|
299
|
-
|
300
|
-
TRIPLE_DES_CTR = "\x90\xCD\b\xD2\xF1\x15:\x98\xF4sJ\xF0\xC9\xAA\xC5\xE3\xB4\xCFq\x93\xBAB\xF9v\xE1\xE7\x8B<\xBC\x97R\xDF?kK~Nw\xF3\x92`\x90]\xD9\xEF\x16\xC85V\x03C\xE9\x14\xF0\x86\xEB\x19\x85\x82\xF6\x16gz\x9B`\xB1\xCE\x80&?\xC8\xBD\xBC+\x91/)\xA5x\xBB\xCF\x06\x15#\e\xB3\xBD\x9B\x1F\xA7\xE2\xC7\xA3\xFC\x06\xC8"
|
301
|
-
|
302
|
-
def test_3des_ctr_for_encryption
|
303
|
-
if defined?(JRUBY_VERSION)
|
304
|
-
# on JRuby, this test fails due to JRUBY-6558
|
305
|
-
puts "Skipping 3des-ctr tests for JRuby"
|
306
|
-
else
|
307
|
-
assert_equal TRIPLE_DES_CTR, encrypt("3des-ctr")
|
308
|
-
end
|
309
|
-
end
|
310
|
-
|
311
|
-
def test_3des_ctr_for_decryption
|
312
|
-
if defined?(JRUBY_VERSION)
|
313
|
-
# on JRuby, this test fails due to JRUBY-6558
|
314
|
-
puts "Skipping 3des-ctr tests for JRuby"
|
315
|
-
else
|
316
|
-
assert_equal TEXT, decrypt("3des-ctr", TRIPLE_DES_CTR)
|
317
|
-
end
|
318
|
-
end
|
319
|
-
|
320
|
-
AES128_CTR = "\x9D\xC7]R\x89\x01\xC4\x14\x00\xE7\xCEc`\x80\v\xC7\xF7\xBD\xD5#d\f\xC9\xB0\xDE\xA6\x8Aq\x10p\x8F\xBC\xFF\x8B\xB4\xC5\xB3\xF7,\xF7eO\x06Q]\x0F\x05\x86\xEC\xA6\xC8\x12\xE9\xC4\x9D0\xD3\x9AL\x192\xAA\xDFu\x0E\xECz\x7F~g\xCA\xEA\xBA\x80,\x83V\x10\xF6/\x04\xD2\x8A\x94\x94\xA9T>~\xD2\r\xE6\x0E\xA0q\xEF"
|
321
|
-
|
322
|
-
def test_aes128_ctr_for_encryption
|
323
|
-
assert_equal AES128_CTR, encrypt("aes128-ctr")
|
324
|
-
end
|
325
|
-
|
326
|
-
def test_aes128_ctr_for_decryption
|
327
|
-
assert_equal TEXT, decrypt("aes128-ctr", AES128_CTR)
|
328
|
-
end
|
329
|
-
|
330
|
-
AES192_CTR = "\xE2\xE7\x1FJ\xE5\xB09\xE1\xB7/\xB3\x95\xF2S\xCE\x8C\x93\x14mFY\x88*\xCE\b\xA6\x87W\xD7\xEC/\xC9\xB6\x9Ba\a\x8E\x89-\xD7\xB2j\a\xB3\a\x92f\"\x96\x8D\xBF\x01\t\xB8Y\xF3\x92\x01\xCC7\xB6w\xF9\"=u:\xA1\xD5*\n\x9E\xC7p\xDC\x11\a\x1C\x88y\xE8\x87`\xA6[fF\x9B\xACv\xA6\xDA1|#F"
|
331
|
-
|
332
|
-
def test_aes192_ctr_for_encryption
|
333
|
-
assert_equal AES192_CTR, encrypt("aes192-ctr")
|
334
|
-
end
|
335
|
-
|
336
|
-
def test_aes192_ctr_for_decryption
|
337
|
-
assert_equal TEXT, decrypt("aes192-ctr", AES192_CTR)
|
338
|
-
end
|
339
|
-
|
340
|
-
AES256_CTR = "2\xB8\xE6\xC9\x95\xB4\x05\xD2\xC7+\x7F\x88\xEB\xD4\xA0\b\"\xBF\x9E\x85t\x19,\e\x90\x11\x04b\xC7\xEE$\xDE\xE6\xC5@G\xFEm\xE1u\x9B\au\xAF\xB5\xB8\x857\x87\x139u\xAC\x1A\xAB\fh\x8FiW~\xB8:\xA4\xA0#~\xC4\x89\xBA5#:\xFC\xC8\xE3\x9B\xF0A2\x87\x980\xD1\xE3\xBC'\xBE\x1E\n\x1A*B\x06\xF3\xCC"
|
341
|
-
|
342
|
-
def test_aes256_ctr_for_encryption
|
343
|
-
assert_equal AES256_CTR, encrypt("aes256-ctr")
|
344
|
-
end
|
345
|
-
|
346
|
-
def test_aes256_ctr_for_decryption
|
347
|
-
assert_equal TEXT, decrypt("aes256-ctr", AES256_CTR)
|
348
|
-
end
|
349
|
-
|
350
|
-
CAMELLIA128_CTR = "$\xCDQ\x86\xFD;Eq\x04\xFD\xEF\xC9\x18\xBA\\ZA\xD1\xA6Z\xC7V\xDE\xCDT\xBB\xC9\xB0BW\x9BOb}O\xCANy\xEA\xBB\xC5\x126\xE3\xDF\xB8]|j\x1D\xAE\"i\x8A\xCB\xE06\x01\xC4\xDA\xF6:\xA7\xB2v\xB0\xAE\xA5m\x16\xDB\xEBR\xCC\xB4\xA3\x93\x11;\xF1\x00\xDFS6\xF8\xD0_\b\nl\xA2\x95\x8E\xF2\xB0\xC1"
|
351
|
-
if_supported?("camellia128-ctr@openssh.org") do
|
352
|
-
def test_camellia128_ctr_openssh_org_for_encryption
|
353
|
-
assert_equal CAMELLIA128_CTR, encrypt("camellia128-ctr@openssh.org")
|
354
|
-
end
|
355
|
-
def test_camellia128_ctr_openssh_org_for_decryption
|
356
|
-
assert_equal TEXT, decrypt("camellia128-ctr@openssh.org", CAMELLIA128_CTR)
|
357
|
-
end
|
358
|
-
end
|
359
|
-
if_supported?("camellia128-ctr") do
|
360
|
-
def test_camellia128_ctr_for_encryption
|
361
|
-
assert_equal CAMELLIA128_CTR, encrypt("camellia128-ctr")
|
362
|
-
end
|
363
|
-
def test_camellia128_ctr_for_decryption
|
364
|
-
assert_equal TEXT, decrypt("camellia128-ctr", CAMELLIA128_CTR)
|
365
|
-
end
|
366
|
-
end
|
367
|
-
|
368
|
-
CAMELLIA192_CTR = "\xB1O;\xA5\xB9 \xD6\x7Fw\ajz\xAF12\x1C\xF0^\xB2\x13\xA7s\xCB\x1A(3Yw\x8B\"7\xD7}\xC4\xAA\xF7\xDB\xF2\xEEi\x02\xD0\x94BK\xD9l\xBC\xBEbrk\x87\x14h\xE1'\xD2\xE4\x8C\x8D\x87\xCE\xBF\x89\xA9\x9E\xC4\f\xB8\x87(\xFE?\xD9\xEF\xBA5\xD8\xA1\rI\xD6s9\x10\xA9l\xB8S\x93}*\x9A\xB0="
|
369
|
-
if_supported?("camellia192-ctr@openssh.org") do
|
370
|
-
def test_camellia192_ctr_openssh_org_for_encryption
|
371
|
-
assert_equal CAMELLIA192_CTR, encrypt("camellia192-ctr@openssh.org")
|
372
|
-
end
|
373
|
-
def test_camellia192_ctr_openssh_org_for_decryption
|
374
|
-
assert_equal TEXT, decrypt("camellia192-ctr@openssh.org", CAMELLIA192_CTR)
|
375
|
-
end
|
376
|
-
end
|
377
|
-
if_supported?("camellia192-ctr") do
|
378
|
-
def test_camellia192_ctr_for_encryption
|
379
|
-
assert_equal CAMELLIA192_CTR, encrypt("camellia192-ctr")
|
380
|
-
end
|
381
|
-
def test_camellia192_ctr_for_decryption
|
382
|
-
assert_equal TEXT, decrypt("camellia192-ctr", CAMELLIA192_CTR)
|
383
|
-
end
|
384
|
-
end
|
385
|
-
|
386
|
-
CAMELLIA256_CTR = "`\x8F#Nqr^m\xB2/i\xF9}\x1E\xD1\xE7X\x99\xAF\x1E\xBA\v\xF3\x8E\xCA\xECZ\xCB\x8A\xC96FW\xB3\x84 bwzRM,P\xC1r\xEFHNr%\xB9\a\xD6\xE6\xE7O\b\xC8?\x98d\x9F\xD3v\x10#\xA6\x87\xB2\x85\x059\xF0-\xF9\xBC\x00V\xB2?\xAE\x1E{\e\xF1\xA9zJ\xC9=1\xB3t73\xEB"
|
387
|
-
if_supported?("camellia256-ctr@openssh.org") do
|
388
|
-
def test_camellia256_ctr_openssh_org_for_encryption
|
389
|
-
assert_equal CAMELLIA256_CTR, encrypt("camellia256-ctr@openssh.org")
|
390
|
-
end
|
391
|
-
def test_camellia256_ctr_openssh_org_for_decryption
|
392
|
-
assert_equal TEXT, decrypt("camellia256-ctr@openssh.org", CAMELLIA256_CTR)
|
393
|
-
end
|
394
|
-
end
|
395
|
-
if_supported?("camellia256-ctr") do
|
396
|
-
def test_camellia256_ctr_for_encryption
|
397
|
-
assert_equal CAMELLIA256_CTR, encrypt("camellia256-ctr")
|
398
|
-
end
|
399
|
-
def test_camellia256_ctr_for_decryption
|
400
|
-
assert_equal TEXT, decrypt("camellia256-ctr", CAMELLIA256_CTR)
|
401
|
-
end
|
402
|
-
end
|
403
|
-
|
404
|
-
def test_none_for_encryption
|
405
|
-
assert_equal TEXT, encrypt("none").strip
|
406
|
-
end
|
407
|
-
|
408
|
-
def test_none_for_decryption
|
409
|
-
assert_equal TEXT, decrypt("none", TEXT)
|
410
|
-
end
|
411
|
-
|
412
|
-
private
|
413
|
-
|
414
|
-
TEXT = "But soft! What light through yonder window breaks? It is the east, and Juliet is the sun!"
|
415
|
-
|
416
|
-
OPTIONS = { :iv => "ABC",
|
417
|
-
:key => "abc",
|
418
|
-
:digester => OpenSSL::Digest::MD5,
|
419
|
-
:shared => "1234567890123456780",
|
420
|
-
:hash => '!@#$%#$^%$&^&%#$@$'
|
421
|
-
}
|
422
|
-
|
423
|
-
def factory
|
424
|
-
Net::SSH::Transport::CipherFactory
|
425
|
-
end
|
426
|
-
|
427
|
-
def encrypt(type)
|
428
|
-
cipher = factory.get(type, OPTIONS.merge(:encrypt => true))
|
429
|
-
padding = TEXT.length % cipher.block_size
|
430
|
-
result = cipher.update(TEXT.dup)
|
431
|
-
result << cipher.update(" " * (cipher.block_size - padding)) if padding > 0
|
432
|
-
result << cipher.final
|
433
|
-
end
|
434
|
-
|
435
|
-
def decrypt(type, data)
|
436
|
-
cipher = factory.get(type, OPTIONS.merge(:decrypt => true))
|
437
|
-
result = cipher.update(data.dup)
|
438
|
-
result << cipher.final
|
439
|
-
result.strip
|
440
|
-
end
|
441
|
-
end
|
442
|
-
|
443
|
-
end
|
data/test/transport/test_hmac.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'common'
|
2
|
-
require 'net/ssh/transport/hmac'
|
3
|
-
|
4
|
-
module Transport
|
5
|
-
|
6
|
-
class TestHMAC < Test::Unit::TestCase
|
7
|
-
Net::SSH::Transport::HMAC::MAP.each do |name, value|
|
8
|
-
method = name.tr("-", "_")
|
9
|
-
define_method("test_get_with_#{method}_returns_new_hmac_instance") do
|
10
|
-
key = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!&$%"[0,Net::SSH::Transport::HMAC::MAP[name].key_length]
|
11
|
-
hmac = Net::SSH::Transport::HMAC.get(name, key, { :shared => "123", :hash => "^&*", :digester => OpenSSL::Digest::SHA1 })
|
12
|
-
assert_instance_of Net::SSH::Transport::HMAC::MAP[name], hmac
|
13
|
-
assert_equal key, hmac.key
|
14
|
-
end
|
15
|
-
|
16
|
-
define_method("test_key_length_with_#{method}_returns_correct_key_length") do
|
17
|
-
assert_equal Net::SSH::Transport::HMAC::MAP[name].key_length, Net::SSH::Transport::HMAC.key_length(name)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_get_with_unrecognized_hmac_raises_argument_error
|
22
|
-
assert_raises(ArgumentError) do
|
23
|
-
Net::SSH::Transport::HMAC.get("bogus")
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_key_length_with_unrecognized_hmac_raises_argument_error
|
28
|
-
assert_raises(ArgumentError) do
|
29
|
-
Net::SSH::Transport::HMAC.get("bogus")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
require 'common'
|
2
|
-
require 'net/ssh/transport/identity_cipher'
|
3
|
-
|
4
|
-
module Transport
|
5
|
-
|
6
|
-
class TestIdentityCipher < Test::Unit::TestCase
|
7
|
-
|
8
|
-
def test_block_size_should_be_8
|
9
|
-
assert_equal 8, cipher.block_size
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_encrypt_should_return_self
|
13
|
-
assert_equal cipher, cipher.encrypt
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_decrypt_should_return_self
|
17
|
-
assert_equal cipher, cipher.decrypt
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_update_should_return_argument
|
21
|
-
assert_equal "hello, world", cipher.update("hello, world")
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_final_should_return_empty_string
|
25
|
-
assert_equal "", cipher.final
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_name_should_be_identity
|
29
|
-
assert_equal "identity", cipher.name
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def cipher
|
35
|
-
Net::SSH::Transport::IdentityCipher
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|