abiquo-installer-tests 20120104 → 20121023.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (265) hide show
  1. data/Rakefile +11 -7
  2. data/bin/abiquo-installer-tests +68 -43
  3. data/tests/1.8.5/abiquo_ciab.rb +21 -0
  4. data/tests/1.8.5/abiquo_kvm.rb +25 -0
  5. data/tests/1.8.5/abiquo_lvmiscsi.rb +17 -0
  6. data/tests/1.8.5/abiquo_monolithic.rb +12 -0
  7. data/tests/1.8.5/abiquo_nfs_repository.rb +23 -0
  8. data/tests/1.8.5/abiquo_platform.rb +39 -0
  9. data/tests/1.8.5/abiquo_remote_services.rb +115 -0
  10. data/tests/1.8.5/abiquo_server.rb +63 -0
  11. data/tests/1.8.5/abiquo_v2v.rb +37 -0
  12. data/tests/1.8.5/abiquo_vbox.rb +27 -0
  13. data/tests/1.8.5/abiquo_xen.rb +27 -0
  14. data/tests/2.0/abiquo_ciab.rb +9 -0
  15. data/tests/2.0/abiquo_community_hypervisor.rb +52 -0
  16. data/tests/2.0/abiquo_kvm.rb +5 -23
  17. data/tests/2.0/abiquo_monolithic.rb +12 -1
  18. data/tests/2.0/abiquo_platform.rb +2 -2
  19. data/tests/2.0/abiquo_remote_services.rb +15 -38
  20. data/tests/2.0/abiquo_server.rb +7 -1
  21. data/tests/2.0/abiquo_v2v.rb +42 -0
  22. data/tests/2.0/abiquo_vbox.rb +5 -25
  23. data/tests/2.0/abiquo_xen.rb +5 -25
  24. data/tests/2.2.0/abiquo_ciab.rb +30 -0
  25. data/tests/2.2.0/abiquo_community_hypervisor.rb +52 -0
  26. data/tests/2.2.0/abiquo_kvm.rb +7 -0
  27. data/tests/2.2.0/abiquo_lvmiscsi.rb +17 -0
  28. data/tests/2.2.0/abiquo_monolithic.rb +23 -0
  29. data/tests/2.2.0/abiquo_nfs_repository.rb +23 -0
  30. data/tests/2.2.0/abiquo_platform.rb +35 -0
  31. data/tests/2.2.0/abiquo_remote_services.rb +96 -0
  32. data/tests/2.2.0/abiquo_server.rb +95 -0
  33. data/tests/2.2.0/abiquo_v2v.rb +79 -0
  34. data/tests/2.2.0/abiquo_vbox.rb +7 -0
  35. data/tests/2.2.0/abiquo_xen.rb +7 -0
  36. data/tests/2.3.0/abiquo_ciab.rb +30 -0
  37. data/tests/2.3.0/abiquo_community_hypervisor.rb +52 -0
  38. data/tests/2.3.0/abiquo_kvm.rb +7 -0
  39. data/tests/2.3.0/abiquo_lvmiscsi.rb +17 -0
  40. data/tests/2.3.0/abiquo_monolithic.rb +23 -0
  41. data/tests/2.3.0/abiquo_nfs_repository.rb +23 -0
  42. data/tests/2.3.0/abiquo_platform.rb +35 -0
  43. data/tests/2.3.0/abiquo_remote_services.rb +96 -0
  44. data/tests/2.3.0/abiquo_server.rb +95 -0
  45. data/tests/2.3.0/abiquo_v2v.rb +79 -0
  46. data/tests/2.3.0/abiquo_vbox.rb +7 -0
  47. data/tests/2.3.0/abiquo_xen.rb +7 -0
  48. data/tests/abiquo_postinst_test.rb +12 -1
  49. data/vendor/net-scp-1.0.4/CHANGELOG.rdoc +29 -0
  50. data/vendor/net-scp-1.0.4/Manifest +17 -0
  51. data/vendor/net-scp-1.0.4/README.rdoc +98 -0
  52. data/vendor/net-scp-1.0.4/Rakefile +83 -0
  53. data/vendor/net-scp-1.0.4/lib/net/scp.rb +432 -0
  54. data/vendor/net-scp-1.0.4/lib/net/scp/download.rb +150 -0
  55. data/vendor/net-scp-1.0.4/lib/net/scp/errors.rb +5 -0
  56. data/vendor/net-scp-1.0.4/lib/net/scp/upload.rb +142 -0
  57. data/vendor/net-scp-1.0.4/lib/net/scp/version.rb +18 -0
  58. data/vendor/net-scp-1.0.4/lib/uri/open-scp.rb +18 -0
  59. data/vendor/net-scp-1.0.4/lib/uri/scp.rb +35 -0
  60. data/vendor/net-scp-1.0.4/net-scp.gemspec +34 -0
  61. data/vendor/net-scp-1.0.4/setup.rb +1331 -0
  62. data/vendor/net-scp-1.0.4/test/common.rb +153 -0
  63. data/vendor/net-scp-1.0.4/test/test_all.rb +3 -0
  64. data/vendor/net-scp-1.0.4/test/test_download.rb +170 -0
  65. data/vendor/net-scp-1.0.4/test/test_scp.rb +60 -0
  66. data/vendor/net-scp-1.0.4/test/test_upload.rb +269 -0
  67. data/vendor/net-sftp-2.0.5/CHANGELOG.rdoc +49 -0
  68. data/vendor/net-sftp-2.0.5/Manifest +55 -0
  69. data/vendor/net-sftp-2.0.5/README.rdoc +96 -0
  70. data/vendor/net-sftp-2.0.5/Rakefile +30 -0
  71. data/vendor/net-sftp-2.0.5/lib/net/sftp.rb +70 -0
  72. data/vendor/net-sftp-2.0.5/lib/net/sftp/constants.rb +187 -0
  73. data/vendor/net-sftp-2.0.5/lib/net/sftp/errors.rb +39 -0
  74. data/vendor/net-sftp-2.0.5/lib/net/sftp/operations/dir.rb +93 -0
  75. data/vendor/net-sftp-2.0.5/lib/net/sftp/operations/download.rb +364 -0
  76. data/vendor/net-sftp-2.0.5/lib/net/sftp/operations/file.rb +176 -0
  77. data/vendor/net-sftp-2.0.5/lib/net/sftp/operations/file_factory.rb +60 -0
  78. data/vendor/net-sftp-2.0.5/lib/net/sftp/operations/upload.rb +387 -0
  79. data/vendor/net-sftp-2.0.5/lib/net/sftp/packet.rb +21 -0
  80. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol.rb +32 -0
  81. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/01/attributes.rb +315 -0
  82. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/01/base.rb +268 -0
  83. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/01/name.rb +43 -0
  84. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/02/base.rb +31 -0
  85. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/03/base.rb +35 -0
  86. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/04/attributes.rb +152 -0
  87. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/04/base.rb +94 -0
  88. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/04/name.rb +67 -0
  89. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/05/base.rb +66 -0
  90. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/06/attributes.rb +107 -0
  91. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/06/base.rb +63 -0
  92. data/vendor/net-sftp-2.0.5/lib/net/sftp/protocol/base.rb +50 -0
  93. data/vendor/net-sftp-2.0.5/lib/net/sftp/request.rb +91 -0
  94. data/vendor/net-sftp-2.0.5/lib/net/sftp/response.rb +76 -0
  95. data/vendor/net-sftp-2.0.5/lib/net/sftp/session.rb +952 -0
  96. data/vendor/net-sftp-2.0.5/lib/net/sftp/version.rb +18 -0
  97. data/vendor/net-sftp-2.0.5/net-sftp.gemspec +34 -0
  98. data/vendor/net-sftp-2.0.5/setup.rb +1331 -0
  99. data/vendor/net-sftp-2.0.5/test/common.rb +172 -0
  100. data/vendor/net-sftp-2.0.5/test/protocol/01/test_attributes.rb +97 -0
  101. data/vendor/net-sftp-2.0.5/test/protocol/01/test_base.rb +210 -0
  102. data/vendor/net-sftp-2.0.5/test/protocol/01/test_name.rb +27 -0
  103. data/vendor/net-sftp-2.0.5/test/protocol/02/test_base.rb +26 -0
  104. data/vendor/net-sftp-2.0.5/test/protocol/03/test_base.rb +27 -0
  105. data/vendor/net-sftp-2.0.5/test/protocol/04/test_attributes.rb +148 -0
  106. data/vendor/net-sftp-2.0.5/test/protocol/04/test_base.rb +74 -0
  107. data/vendor/net-sftp-2.0.5/test/protocol/04/test_name.rb +53 -0
  108. data/vendor/net-sftp-2.0.5/test/protocol/05/test_base.rb +62 -0
  109. data/vendor/net-sftp-2.0.5/test/protocol/06/test_attributes.rb +124 -0
  110. data/vendor/net-sftp-2.0.5/test/protocol/06/test_base.rb +51 -0
  111. data/vendor/net-sftp-2.0.5/test/protocol/test_base.rb +42 -0
  112. data/vendor/net-sftp-2.0.5/test/test_all.rb +7 -0
  113. data/vendor/net-sftp-2.0.5/test/test_dir.rb +47 -0
  114. data/vendor/net-sftp-2.0.5/test/test_download.rb +252 -0
  115. data/vendor/net-sftp-2.0.5/test/test_file.rb +159 -0
  116. data/vendor/net-sftp-2.0.5/test/test_file_factory.rb +48 -0
  117. data/vendor/net-sftp-2.0.5/test/test_packet.rb +9 -0
  118. data/vendor/net-sftp-2.0.5/test/test_protocol.rb +17 -0
  119. data/vendor/net-sftp-2.0.5/test/test_request.rb +71 -0
  120. data/vendor/net-sftp-2.0.5/test/test_response.rb +53 -0
  121. data/vendor/net-sftp-2.0.5/test/test_session.rb +741 -0
  122. data/vendor/net-sftp-2.0.5/test/test_upload.rb +219 -0
  123. data/vendor/net-ssh-2.5.2/CHANGELOG.rdoc +295 -0
  124. data/vendor/net-ssh-2.5.2/LICENSE.rdoc +19 -0
  125. data/vendor/net-ssh-2.5.2/Manifest +132 -0
  126. data/vendor/net-ssh-2.5.2/README.rdoc +184 -0
  127. data/vendor/net-ssh-2.5.2/Rakefile +88 -0
  128. data/vendor/net-ssh-2.5.2/Rudyfile +96 -0
  129. data/vendor/net-ssh-2.5.2/THANKS.rdoc +19 -0
  130. data/vendor/net-ssh-2.5.2/lib/net/ssh.rb +223 -0
  131. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/agent.rb +23 -0
  132. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/agent/java_pageant.rb +85 -0
  133. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/agent/socket.rb +170 -0
  134. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/constants.rb +18 -0
  135. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/key_manager.rb +253 -0
  136. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/methods/abstract.rb +60 -0
  137. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/methods/hostbased.rb +75 -0
  138. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/methods/keyboard_interactive.rb +70 -0
  139. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/methods/password.rb +43 -0
  140. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/methods/publickey.rb +96 -0
  141. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/pageant.rb +264 -0
  142. data/vendor/net-ssh-2.5.2/lib/net/ssh/authentication/session.rb +154 -0
  143. data/vendor/net-ssh-2.5.2/lib/net/ssh/buffer.rb +350 -0
  144. data/vendor/net-ssh-2.5.2/lib/net/ssh/buffered_io.rb +198 -0
  145. data/vendor/net-ssh-2.5.2/lib/net/ssh/config.rb +207 -0
  146. data/vendor/net-ssh-2.5.2/lib/net/ssh/connection/channel.rb +630 -0
  147. data/vendor/net-ssh-2.5.2/lib/net/ssh/connection/constants.rb +33 -0
  148. data/vendor/net-ssh-2.5.2/lib/net/ssh/connection/session.rb +597 -0
  149. data/vendor/net-ssh-2.5.2/lib/net/ssh/connection/term.rb +178 -0
  150. data/vendor/net-ssh-2.5.2/lib/net/ssh/errors.rb +88 -0
  151. data/vendor/net-ssh-2.5.2/lib/net/ssh/key_factory.rb +107 -0
  152. data/vendor/net-ssh-2.5.2/lib/net/ssh/known_hosts.rb +141 -0
  153. data/vendor/net-ssh-2.5.2/lib/net/ssh/loggable.rb +61 -0
  154. data/vendor/net-ssh-2.5.2/lib/net/ssh/packet.rb +102 -0
  155. data/vendor/net-ssh-2.5.2/lib/net/ssh/prompt.rb +93 -0
  156. data/vendor/net-ssh-2.5.2/lib/net/ssh/proxy/command.rb +75 -0
  157. data/vendor/net-ssh-2.5.2/lib/net/ssh/proxy/errors.rb +14 -0
  158. data/vendor/net-ssh-2.5.2/lib/net/ssh/proxy/http.rb +94 -0
  159. data/vendor/net-ssh-2.5.2/lib/net/ssh/proxy/socks4.rb +70 -0
  160. data/vendor/net-ssh-2.5.2/lib/net/ssh/proxy/socks5.rb +142 -0
  161. data/vendor/net-ssh-2.5.2/lib/net/ssh/ruby_compat.rb +51 -0
  162. data/vendor/net-ssh-2.5.2/lib/net/ssh/service/forward.rb +298 -0
  163. data/vendor/net-ssh-2.5.2/lib/net/ssh/test.rb +89 -0
  164. data/vendor/net-ssh-2.5.2/lib/net/ssh/test/channel.rb +129 -0
  165. data/vendor/net-ssh-2.5.2/lib/net/ssh/test/extensions.rb +152 -0
  166. data/vendor/net-ssh-2.5.2/lib/net/ssh/test/kex.rb +44 -0
  167. data/vendor/net-ssh-2.5.2/lib/net/ssh/test/local_packet.rb +51 -0
  168. data/vendor/net-ssh-2.5.2/lib/net/ssh/test/packet.rb +81 -0
  169. data/vendor/net-ssh-2.5.2/lib/net/ssh/test/remote_packet.rb +38 -0
  170. data/vendor/net-ssh-2.5.2/lib/net/ssh/test/script.rb +157 -0
  171. data/vendor/net-ssh-2.5.2/lib/net/ssh/test/socket.rb +64 -0
  172. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/algorithms.rb +407 -0
  173. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/cipher_factory.rb +106 -0
  174. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/constants.rb +32 -0
  175. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/ctr.rb +95 -0
  176. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac.rb +45 -0
  177. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/abstract.rb +79 -0
  178. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/md5.rb +12 -0
  179. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/md5_96.rb +11 -0
  180. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/none.rb +15 -0
  181. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/ripemd160.rb +13 -0
  182. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha1.rb +13 -0
  183. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha1_96.rb +11 -0
  184. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha2_256.rb +15 -0
  185. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha2_256_96.rb +13 -0
  186. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha2_512.rb +14 -0
  187. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/hmac/sha2_512_96.rb +13 -0
  188. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/identity_cipher.rb +55 -0
  189. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex.rb +28 -0
  190. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/diffie_hellman_group14_sha1.rb +44 -0
  191. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb +216 -0
  192. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb +80 -0
  193. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha256.rb +15 -0
  194. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb +93 -0
  195. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/ecdh_sha2_nistp384.rb +13 -0
  196. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/kex/ecdh_sha2_nistp521.rb +13 -0
  197. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/key_expander.rb +26 -0
  198. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/openssl.rb +237 -0
  199. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/packet_stream.rb +235 -0
  200. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/server_version.rb +71 -0
  201. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/session.rb +278 -0
  202. data/vendor/net-ssh-2.5.2/lib/net/ssh/transport/state.rb +206 -0
  203. data/vendor/net-ssh-2.5.2/lib/net/ssh/verifiers/lenient.rb +30 -0
  204. data/vendor/net-ssh-2.5.2/lib/net/ssh/verifiers/null.rb +12 -0
  205. data/vendor/net-ssh-2.5.2/lib/net/ssh/verifiers/strict.rb +53 -0
  206. data/vendor/net-ssh-2.5.2/lib/net/ssh/version.rb +62 -0
  207. data/vendor/net-ssh-2.5.2/net-ssh.gemspec +172 -0
  208. data/vendor/net-ssh-2.5.2/setup.rb +1585 -0
  209. data/vendor/net-ssh-2.5.2/support/arcfour_check.rb +20 -0
  210. data/vendor/net-ssh-2.5.2/support/ssh_tunnel_bug.rb +65 -0
  211. data/vendor/net-ssh-2.5.2/test/README.txt +43 -0
  212. data/vendor/net-ssh-2.5.2/test/authentication/methods/common.rb +28 -0
  213. data/vendor/net-ssh-2.5.2/test/authentication/methods/test_abstract.rb +51 -0
  214. data/vendor/net-ssh-2.5.2/test/authentication/methods/test_hostbased.rb +114 -0
  215. data/vendor/net-ssh-2.5.2/test/authentication/methods/test_keyboard_interactive.rb +100 -0
  216. data/vendor/net-ssh-2.5.2/test/authentication/methods/test_password.rb +52 -0
  217. data/vendor/net-ssh-2.5.2/test/authentication/methods/test_publickey.rb +148 -0
  218. data/vendor/net-ssh-2.5.2/test/authentication/test_agent.rb +205 -0
  219. data/vendor/net-ssh-2.5.2/test/authentication/test_key_manager.rb +218 -0
  220. data/vendor/net-ssh-2.5.2/test/authentication/test_session.rb +106 -0
  221. data/vendor/net-ssh-2.5.2/test/common.rb +107 -0
  222. data/vendor/net-ssh-2.5.2/test/configs/eqsign +3 -0
  223. data/vendor/net-ssh-2.5.2/test/configs/exact_match +8 -0
  224. data/vendor/net-ssh-2.5.2/test/configs/host_plus +10 -0
  225. data/vendor/net-ssh-2.5.2/test/configs/multihost +4 -0
  226. data/vendor/net-ssh-2.5.2/test/configs/nohost +19 -0
  227. data/vendor/net-ssh-2.5.2/test/configs/numeric_host +4 -0
  228. data/vendor/net-ssh-2.5.2/test/configs/wild_cards +14 -0
  229. data/vendor/net-ssh-2.5.2/test/connection/test_channel.rb +467 -0
  230. data/vendor/net-ssh-2.5.2/test/connection/test_session.rb +488 -0
  231. data/vendor/net-ssh-2.5.2/test/known_hosts/github +1 -0
  232. data/vendor/net-ssh-2.5.2/test/manual/test_forward.rb +223 -0
  233. data/vendor/net-ssh-2.5.2/test/start/test_transport.rb +28 -0
  234. data/vendor/net-ssh-2.5.2/test/test_all.rb +9 -0
  235. data/vendor/net-ssh-2.5.2/test/test_buffer.rb +426 -0
  236. data/vendor/net-ssh-2.5.2/test/test_buffered_io.rb +63 -0
  237. data/vendor/net-ssh-2.5.2/test/test_config.rb +120 -0
  238. data/vendor/net-ssh-2.5.2/test/test_key_factory.rb +121 -0
  239. data/vendor/net-ssh-2.5.2/test/test_known_hosts.rb +13 -0
  240. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_md5.rb +39 -0
  241. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_md5_96.rb +25 -0
  242. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_none.rb +34 -0
  243. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_ripemd160.rb +34 -0
  244. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha1.rb +34 -0
  245. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha1_96.rb +25 -0
  246. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha2_256.rb +35 -0
  247. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha2_256_96.rb +25 -0
  248. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha2_512.rb +35 -0
  249. data/vendor/net-ssh-2.5.2/test/transport/hmac/test_sha2_512_96.rb +25 -0
  250. data/vendor/net-ssh-2.5.2/test/transport/kex/test_diffie_hellman_group14_sha1.rb +13 -0
  251. data/vendor/net-ssh-2.5.2/test/transport/kex/test_diffie_hellman_group1_sha1.rb +146 -0
  252. data/vendor/net-ssh-2.5.2/test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb +92 -0
  253. data/vendor/net-ssh-2.5.2/test/transport/kex/test_diffie_hellman_group_exchange_sha256.rb +33 -0
  254. data/vendor/net-ssh-2.5.2/test/transport/kex/test_ecdh_sha2_nistp256.rb +161 -0
  255. data/vendor/net-ssh-2.5.2/test/transport/kex/test_ecdh_sha2_nistp384.rb +37 -0
  256. data/vendor/net-ssh-2.5.2/test/transport/kex/test_ecdh_sha2_nistp521.rb +37 -0
  257. data/vendor/net-ssh-2.5.2/test/transport/test_algorithms.rb +330 -0
  258. data/vendor/net-ssh-2.5.2/test/transport/test_cipher_factory.rb +441 -0
  259. data/vendor/net-ssh-2.5.2/test/transport/test_hmac.rb +34 -0
  260. data/vendor/net-ssh-2.5.2/test/transport/test_identity_cipher.rb +40 -0
  261. data/vendor/net-ssh-2.5.2/test/transport/test_packet_stream.rb +1745 -0
  262. data/vendor/net-ssh-2.5.2/test/transport/test_server_version.rb +78 -0
  263. data/vendor/net-ssh-2.5.2/test/transport/test_session.rb +315 -0
  264. data/vendor/net-ssh-2.5.2/test/transport/test_state.rb +179 -0
  265. metadata +325 -78
@@ -0,0 +1,148 @@
1
+ require 'common'
2
+ require 'net/ssh/authentication/methods/publickey'
3
+ require 'authentication/methods/common'
4
+
5
+ module Authentication; module Methods
6
+
7
+ class TestPublickey < Test::Unit::TestCase
8
+ include Common
9
+
10
+ def test_authenticate_should_return_false_when_no_key_manager_has_been_set
11
+ assert_equal false, subject(:key_manager => nil).authenticate("ssh-connection", "jamis")
12
+ end
13
+
14
+ def test_authenticate_should_return_false_when_key_manager_has_no_keys
15
+ assert_equal false, subject(:keys => []).authenticate("ssh-connection", "jamis")
16
+ end
17
+
18
+ def test_authenticate_should_return_false_if_no_keys_can_authenticate
19
+ transport.expect do |t, packet|
20
+ assert_equal USERAUTH_REQUEST, packet.type
21
+ assert verify_userauth_request_packet(packet, keys.first, false)
22
+ t.return(USERAUTH_FAILURE, :string, "hostbased,password")
23
+
24
+ t.expect do |t2, packet2|
25
+ assert_equal USERAUTH_REQUEST, packet2.type
26
+ assert verify_userauth_request_packet(packet2, keys.last, false)
27
+ t2.return(USERAUTH_FAILURE, :string, "hostbased,password")
28
+ end
29
+ end
30
+
31
+ assert_equal false, subject.authenticate("ssh-connection", "jamis")
32
+ end
33
+
34
+ def test_authenticate_should_raise_if_publickey_disallowed
35
+ key_manager.expects(:sign).with(&signature_parameters(keys.first)).returns("sig-one")
36
+
37
+ transport.expect do |t, packet|
38
+ assert_equal USERAUTH_REQUEST, packet.type
39
+ assert verify_userauth_request_packet(packet, keys.first, false)
40
+ t.return(USERAUTH_PK_OK, :string, keys.first.ssh_type, :string, Net::SSH::Buffer.from(:key, keys.first))
41
+
42
+ t.expect do |t2,packet2|
43
+ assert_equal USERAUTH_REQUEST, packet2.type
44
+ assert verify_userauth_request_packet(packet2, keys.first, true)
45
+ assert_equal "sig-one", packet2.read_string
46
+ t2.return(USERAUTH_FAILURE, :string, "hostbased,password")
47
+ end
48
+ end
49
+
50
+ assert_raises Net::SSH::Authentication::DisallowedMethod do
51
+ subject.authenticate("ssh-connection", "jamis")
52
+ end
53
+ end
54
+
55
+ def test_authenticate_should_return_false_if_signature_exchange_fails
56
+ key_manager.expects(:sign).with(&signature_parameters(keys.first)).returns("sig-one")
57
+ key_manager.expects(:sign).with(&signature_parameters(keys.last)).returns("sig-two")
58
+
59
+ transport.expect do |t, packet|
60
+ assert_equal USERAUTH_REQUEST, packet.type
61
+ assert verify_userauth_request_packet(packet, keys.first, false)
62
+ t.return(USERAUTH_PK_OK, :string, keys.first.ssh_type, :string, Net::SSH::Buffer.from(:key, keys.first))
63
+
64
+ t.expect do |t2,packet2|
65
+ assert_equal USERAUTH_REQUEST, packet2.type
66
+ assert verify_userauth_request_packet(packet2, keys.first, true)
67
+ assert_equal "sig-one", packet2.read_string
68
+ t2.return(USERAUTH_FAILURE, :string, "publickey")
69
+
70
+ t2.expect do |t3, packet3|
71
+ assert_equal USERAUTH_REQUEST, packet3.type
72
+ assert verify_userauth_request_packet(packet3, keys.last, false)
73
+ t3.return(USERAUTH_PK_OK, :string, keys.last.ssh_type, :string, Net::SSH::Buffer.from(:key, keys.last))
74
+
75
+ t3.expect do |t4,packet4|
76
+ assert_equal USERAUTH_REQUEST, packet4.type
77
+ assert verify_userauth_request_packet(packet4, keys.last, true)
78
+ assert_equal "sig-two", packet4.read_string
79
+ t4.return(USERAUTH_FAILURE, :string, "publickey")
80
+ end
81
+ end
82
+ end
83
+ end
84
+
85
+ assert !subject.authenticate("ssh-connection", "jamis")
86
+ end
87
+
88
+ def test_authenticate_should_return_true_if_any_key_can_authenticate
89
+ key_manager.expects(:sign).with(&signature_parameters(keys.first)).returns("sig-one")
90
+
91
+ transport.expect do |t, packet|
92
+ assert_equal USERAUTH_REQUEST, packet.type
93
+ assert verify_userauth_request_packet(packet, keys.first, false)
94
+ t.return(USERAUTH_PK_OK, :string, keys.first.ssh_type, :string, Net::SSH::Buffer.from(:key, keys.first))
95
+
96
+ t.expect do |t2,packet2|
97
+ assert_equal USERAUTH_REQUEST, packet2.type
98
+ assert verify_userauth_request_packet(packet2, keys.first, true)
99
+ assert_equal "sig-one", packet2.read_string
100
+ t2.return(USERAUTH_SUCCESS)
101
+ end
102
+ end
103
+
104
+ assert subject.authenticate("ssh-connection", "jamis")
105
+ end
106
+
107
+ private
108
+
109
+ def signature_parameters(key)
110
+ Proc.new do |given_key, data|
111
+ next false unless given_key.to_blob == key.to_blob
112
+ buffer = Net::SSH::Buffer.new(data)
113
+ buffer.read_string == "abcxyz123" && # session-id
114
+ buffer.read_byte == USERAUTH_REQUEST && # type
115
+ verify_userauth_request_packet(buffer, key, true)
116
+ end
117
+ end
118
+
119
+ def verify_userauth_request_packet(packet, key, has_sig)
120
+ packet.read_string == "jamis" && # user-name
121
+ packet.read_string == "ssh-connection" && # next service
122
+ packet.read_string == "publickey" && # auth-method
123
+ packet.read_bool == has_sig && # whether a signature is appended
124
+ packet.read_string == key.ssh_type && # ssh key type
125
+ packet.read_buffer.read_key.to_blob == key.to_blob # key
126
+ end
127
+
128
+ @@keys = nil
129
+ def keys
130
+ @@keys ||= [OpenSSL::PKey::RSA.new(512), OpenSSL::PKey::DSA.new(512)]
131
+ end
132
+
133
+ def key_manager(options={})
134
+ @key_manager ||= begin
135
+ manager = stub("key_manager")
136
+ manager.stubs(:each_identity).multiple_yields(*(options[:keys] || keys))
137
+ manager
138
+ end
139
+ end
140
+
141
+ def subject(options={})
142
+ options[:key_manager] = key_manager(options) unless options.key?(:key_manager)
143
+ @subject ||= Net::SSH::Authentication::Methods::Publickey.new(session(options), options)
144
+ end
145
+
146
+ end
147
+
148
+ end; end
@@ -0,0 +1,205 @@
1
+ require 'common'
2
+ require 'net/ssh/authentication/agent'
3
+
4
+ module Authentication
5
+
6
+ class TestAgent < Test::Unit::TestCase
7
+
8
+ SSH2_AGENT_REQUEST_VERSION = 1
9
+ SSH2_AGENT_REQUEST_IDENTITIES = 11
10
+ SSH2_AGENT_IDENTITIES_ANSWER = 12
11
+ SSH2_AGENT_SIGN_REQUEST = 13
12
+ SSH2_AGENT_SIGN_RESPONSE = 14
13
+ SSH2_AGENT_FAILURE = 30
14
+ SSH2_AGENT_VERSION_RESPONSE = 103
15
+
16
+ SSH_COM_AGENT2_FAILURE = 102
17
+
18
+ SSH_AGENT_REQUEST_RSA_IDENTITIES = 1
19
+ SSH_AGENT_RSA_IDENTITIES_ANSWER = 2
20
+ SSH_AGENT_FAILURE = 5
21
+
22
+ def setup
23
+ @original, ENV['SSH_AUTH_SOCK'] = ENV['SSH_AUTH_SOCK'], "/path/to/ssh.agent.sock"
24
+ end
25
+
26
+ def teardown
27
+ ENV['SSH_AUTH_SOCK'] = @original
28
+ end
29
+
30
+ def test_connect_should_use_agent_factory_to_determine_connection_type
31
+ factory.expects(:open).with("/path/to/ssh.agent.sock").returns(socket)
32
+ agent(false).connect!
33
+ end
34
+
35
+ def test_connect_should_raise_error_if_connection_could_not_be_established
36
+ factory.expects(:open).raises(SocketError)
37
+ assert_raises(Net::SSH::Authentication::AgentNotAvailable) { agent(false).connect! }
38
+ end
39
+
40
+ def test_negotiate_should_raise_error_if_ssh2_agent_response_recieved
41
+ socket.expect do |s, type, buffer|
42
+ assert_equal SSH2_AGENT_REQUEST_VERSION, type
43
+ assert_equal Net::SSH::Transport::ServerVersion::PROTO_VERSION, buffer.read_string
44
+ s.return(SSH2_AGENT_VERSION_RESPONSE)
45
+ end
46
+ assert_raises(NotImplementedError) { agent.negotiate! }
47
+ end
48
+
49
+ def test_negotiate_should_raise_error_if_response_was_unexpected
50
+ socket.expect do |s, type, buffer|
51
+ assert_equal SSH2_AGENT_REQUEST_VERSION, type
52
+ s.return(255)
53
+ end
54
+ assert_raises(Net::SSH::Authentication::AgentError) { agent.negotiate! }
55
+ end
56
+
57
+ def test_negotiate_should_be_successful_with_expected_response
58
+ socket.expect do |s, type, buffer|
59
+ assert_equal SSH2_AGENT_REQUEST_VERSION, type
60
+ s.return(SSH_AGENT_RSA_IDENTITIES_ANSWER)
61
+ end
62
+ assert_nothing_raised { agent(:connect).negotiate! }
63
+ end
64
+
65
+ def test_identities_should_fail_if_SSH_AGENT_FAILURE_recieved
66
+ socket.expect do |s, type, buffer|
67
+ assert_equal SSH2_AGENT_REQUEST_IDENTITIES, type
68
+ s.return(SSH_AGENT_FAILURE)
69
+ end
70
+ assert_raises(Net::SSH::Authentication::AgentError) { agent.identities }
71
+ end
72
+
73
+ def test_identities_should_fail_if_SSH2_AGENT_FAILURE_recieved
74
+ socket.expect do |s, type, buffer|
75
+ assert_equal SSH2_AGENT_REQUEST_IDENTITIES, type
76
+ s.return(SSH2_AGENT_FAILURE)
77
+ end
78
+ assert_raises(Net::SSH::Authentication::AgentError) { agent.identities }
79
+ end
80
+
81
+ def test_identities_should_fail_if_SSH_COM_AGENT2_FAILURE_recieved
82
+ socket.expect do |s, type, buffer|
83
+ assert_equal SSH2_AGENT_REQUEST_IDENTITIES, type
84
+ s.return(SSH_COM_AGENT2_FAILURE)
85
+ end
86
+ assert_raises(Net::SSH::Authentication::AgentError) { agent.identities }
87
+ end
88
+
89
+ def test_identities_should_fail_if_response_is_not_SSH2_AGENT_IDENTITIES_ANSWER
90
+ socket.expect do |s, type, buffer|
91
+ assert_equal SSH2_AGENT_REQUEST_IDENTITIES, type
92
+ s.return(255)
93
+ end
94
+ assert_raises(Net::SSH::Authentication::AgentError) { agent.identities }
95
+ end
96
+
97
+ def test_identities_should_augment_identities_with_comment_field
98
+ key1 = key
99
+ key2 = OpenSSL::PKey::DSA.new(512)
100
+
101
+ socket.expect do |s, type, buffer|
102
+ assert_equal SSH2_AGENT_REQUEST_IDENTITIES, type
103
+ s.return(SSH2_AGENT_IDENTITIES_ANSWER, :long, 2, :string, Net::SSH::Buffer.from(:key, key1), :string, "My favorite key", :string, Net::SSH::Buffer.from(:key, key2), :string, "Okay, but not the best")
104
+ end
105
+
106
+ result = agent.identities
107
+ assert_equal key1.to_blob, result.first.to_blob
108
+ assert_equal key2.to_blob, result.last.to_blob
109
+ assert_equal "My favorite key", result.first.comment
110
+ assert_equal "Okay, but not the best", result.last.comment
111
+ end
112
+
113
+ def test_close_should_close_socket
114
+ socket.expects(:close)
115
+ agent.close
116
+ end
117
+
118
+ def test_sign_should_fail_if_response_is_SSH_AGENT_FAILURE
119
+ socket.expect { |s,| s.return(SSH_AGENT_FAILURE) }
120
+ assert_raises(Net::SSH::Authentication::AgentError) { agent.sign(key, "hello world") }
121
+ end
122
+
123
+ def test_sign_should_fail_if_response_is_SSH2_AGENT_FAILURE
124
+ socket.expect { |s,| s.return(SSH2_AGENT_FAILURE) }
125
+ assert_raises(Net::SSH::Authentication::AgentError) { agent.sign(key, "hello world") }
126
+ end
127
+
128
+ def test_sign_should_fail_if_response_is_SSH_COM_AGENT2_FAILURE
129
+ socket.expect { |s,| s.return(SSH_COM_AGENT2_FAILURE) }
130
+ assert_raises(Net::SSH::Authentication::AgentError) { agent.sign(key, "hello world") }
131
+ end
132
+
133
+ def test_sign_should_fail_if_response_is_not_SSH2_AGENT_SIGN_RESPONSE
134
+ socket.expect { |s,| s.return(255) }
135
+ assert_raises(Net::SSH::Authentication::AgentError) { agent.sign(key, "hello world") }
136
+ end
137
+
138
+ def test_sign_should_return_signed_data_from_agent
139
+ socket.expect do |s,type,buffer|
140
+ assert_equal SSH2_AGENT_SIGN_REQUEST, type
141
+ assert_equal key.to_blob, Net::SSH::Buffer.new(buffer.read_string).read_key.to_blob
142
+ assert_equal "hello world", buffer.read_string
143
+ assert_equal 0, buffer.read_long
144
+
145
+ s.return(SSH2_AGENT_SIGN_RESPONSE, :string, "abcxyz123")
146
+ end
147
+
148
+ assert_equal "abcxyz123", agent.sign(key, "hello world")
149
+ end
150
+
151
+ private
152
+
153
+ class MockSocket
154
+ def initialize
155
+ @expectation = nil
156
+ @buffer = Net::SSH::Buffer.new
157
+ end
158
+
159
+ def expect(&block)
160
+ @expectation = block
161
+ end
162
+
163
+ def return(type, *args)
164
+ data = Net::SSH::Buffer.from(*args)
165
+ @buffer.append([data.length+1, type, data.to_s].pack("NCA*"))
166
+ end
167
+
168
+ def send(data, flags)
169
+ raise "got #{data.inspect} but no packet was expected" unless @expectation
170
+ buffer = Net::SSH::Buffer.new(data)
171
+ buffer.read_long # skip the length
172
+ type = buffer.read_byte
173
+ @expectation.call(self, type, buffer)
174
+ @expectation = nil
175
+ end
176
+
177
+ def read(length)
178
+ @buffer.read(length)
179
+ end
180
+ end
181
+
182
+ def key
183
+ @key ||= OpenSSL::PKey::RSA.new(512)
184
+ end
185
+
186
+ def socket
187
+ @socket ||= MockSocket.new
188
+ end
189
+
190
+ def factory
191
+ @factory ||= stub("socket factory", :open => socket)
192
+ end
193
+
194
+ def agent(auto=:connect)
195
+ @agent ||= begin
196
+ agent = Net::SSH::Authentication::Agent.new
197
+ agent.stubs(:agent_socket_factory).returns(factory)
198
+ agent.connect! if auto == :connect
199
+ agent
200
+ end
201
+ end
202
+
203
+ end
204
+
205
+ end
@@ -0,0 +1,218 @@
1
+ require 'common'
2
+ require 'net/ssh/authentication/key_manager'
3
+
4
+ module Authentication
5
+
6
+ class TestKeyManager < Test::Unit::TestCase
7
+ def test_key_files_and_known_identities_are_empty_by_default
8
+ assert manager.key_files.empty?
9
+ assert manager.known_identities.empty?
10
+ end
11
+
12
+ def test_assume_agent_is_available_by_default
13
+ assert manager.use_agent?
14
+ end
15
+
16
+ def test_add_ensures_list_is_unique
17
+ manager.add "/first"
18
+ manager.add "/second"
19
+ manager.add "/third"
20
+ manager.add "/second"
21
+ assert_true manager.key_files.length == 3
22
+ final_files = manager.key_files.map {|item| item.split('/').last}
23
+ assert_equal %w(first second third), final_files
24
+ end
25
+
26
+ def test_use_agent_should_be_set_to_false_if_agent_could_not_be_found
27
+ Net::SSH::Authentication::Agent.expects(:connect).raises(Net::SSH::Authentication::AgentNotAvailable)
28
+ assert manager.use_agent?
29
+ assert_nil manager.agent
30
+ assert !manager.use_agent?
31
+ end
32
+
33
+ def test_each_identity_should_load_from_key_files
34
+ manager.stubs(:agent).returns(nil)
35
+ first = File.expand_path("/first")
36
+ second = File.expand_path("/second")
37
+ stub_file_private_key first, rsa
38
+ stub_file_private_key second, dsa
39
+
40
+ identities = []
41
+ manager.each_identity { |identity| identities << identity }
42
+
43
+ assert_equal 2, identities.length
44
+ assert_equal rsa.to_blob, identities.first.to_blob
45
+ assert_equal dsa.to_blob, identities.last.to_blob
46
+
47
+ assert_equal({:from => :file, :file => first, :key => rsa}, manager.known_identities[rsa])
48
+ assert_equal({:from => :file, :file => second, :key => dsa}, manager.known_identities[dsa])
49
+ end
50
+
51
+ def test_identities_should_load_from_agent
52
+ manager.stubs(:agent).returns(agent)
53
+
54
+ identities = []
55
+ manager.each_identity { |identity| identities << identity }
56
+
57
+ assert_equal 2, identities.length
58
+ assert_equal rsa.to_blob, identities.first.to_blob
59
+ assert_equal dsa.to_blob, identities.last.to_blob
60
+
61
+ assert_equal({:from => :agent}, manager.known_identities[rsa])
62
+ assert_equal({:from => :agent}, manager.known_identities[dsa])
63
+ end
64
+
65
+ if defined?(OpenSSL::PKey::EC)
66
+ def test_identities_with_ecdsa_should_load_from_agent
67
+ manager.stubs(:agent).returns(agent_with_ecdsa_keys)
68
+
69
+ identities = []
70
+ manager.each_identity { |identity| identities << identity }
71
+ assert_equal 5, identities.length
72
+
73
+ assert_equal rsa.to_blob, identities[0].to_blob
74
+ assert_equal dsa.to_blob, identities[1].to_blob
75
+ assert_equal ecdsa_sha2_nistp256.to_blob, identities[2].to_blob
76
+ assert_equal ecdsa_sha2_nistp384.to_blob, identities[3].to_blob
77
+ assert_equal ecdsa_sha2_nistp521.to_blob, identities[4].to_blob
78
+
79
+ assert_equal({:from => :agent}, manager.known_identities[rsa])
80
+ assert_equal({:from => :agent}, manager.known_identities[dsa])
81
+ assert_equal({:from => :agent}, manager.known_identities[ecdsa_sha2_nistp256])
82
+ assert_equal({:from => :agent}, manager.known_identities[ecdsa_sha2_nistp384])
83
+ assert_equal({:from => :agent}, manager.known_identities[ecdsa_sha2_nistp521])
84
+ end
85
+ end
86
+
87
+ def test_only_identities_with_key_files_should_load_from_agent_of_keys_only_set
88
+ manager(:keys_only => true).stubs(:agent).returns(agent)
89
+
90
+ first = File.expand_path("/first")
91
+ stub_file_private_key first, rsa
92
+
93
+ identities = []
94
+ manager.each_identity { |identity| identities << identity }
95
+
96
+ assert_equal 1, identities.length
97
+ assert_equal rsa.to_blob, identities.first.to_blob
98
+
99
+ assert_equal({:from => :agent}, manager.known_identities[rsa])
100
+ end
101
+
102
+ def test_identities_without_public_key_files_should_not_be_touched_if_identity_loaded_from_agent
103
+ manager.stubs(:agent).returns(agent)
104
+
105
+ first = File.expand_path("/first")
106
+ stub_file_public_key first, rsa
107
+ second = File.expand_path("/second")
108
+ stub_file_private_key second, dsa, :passphrase => :should_not_be_asked
109
+
110
+ identities = []
111
+ manager.each_identity do |identity|
112
+ identities << identity
113
+ break if manager.known_identities[identity][:from] == :agent
114
+ end
115
+
116
+ assert_equal 1, identities.length
117
+ assert_equal rsa.to_blob, identities.first.to_blob
118
+ end
119
+
120
+ def test_sign_with_agent_originated_key_should_request_signature_from_agent
121
+ manager.stubs(:agent).returns(agent)
122
+ manager.each_identity { |identity| } # preload the known_identities
123
+ agent.expects(:sign).with(rsa, "hello, world").returns("abcxyz123")
124
+ assert_equal "abcxyz123", manager.sign(rsa, "hello, world")
125
+ end
126
+
127
+ def test_sign_with_file_originated_key_should_load_private_key_and_sign_with_it
128
+ manager.stubs(:agent).returns(nil)
129
+ first = File.expand_path("/first")
130
+ stub_file_private_key first, rsa(512)
131
+ rsa.expects(:ssh_do_sign).with("hello, world").returns("abcxyz123")
132
+ manager.each_identity { |identity| } # preload the known_identities
133
+ assert_equal "\0\0\0\assh-rsa\0\0\0\011abcxyz123", manager.sign(rsa, "hello, world")
134
+ end
135
+
136
+ def test_sign_with_file_originated_key_should_raise_key_manager_error_if_unloadable
137
+ manager.known_identities[rsa] = { :from => :file, :file => "/first" }
138
+
139
+ Net::SSH::KeyFactory.expects(:load_private_key).raises(OpenSSL::PKey::RSAError)
140
+
141
+ assert_raises Net::SSH::Authentication::KeyManagerError do
142
+ manager.sign(rsa, "hello, world")
143
+ end
144
+ end
145
+
146
+ private
147
+
148
+ def stub_file_private_key(name, key, options = {})
149
+ manager.add(name)
150
+ File.stubs(:readable?).with(name).returns(true)
151
+ File.stubs(:readable?).with(name + ".pub").returns(false)
152
+
153
+ case options.fetch(:passphrase, :indifferently)
154
+ when :should_be_asked
155
+ Net::SSH::KeyFactory.expects(:load_private_key).with(name, nil, false).raises(OpenSSL::PKey::RSAError).at_least_once
156
+ Net::SSH::KeyFactory.expects(:load_private_key).with(name, nil, true).returns(key).at_least_once
157
+ when :should_not_be_asked
158
+ Net::SSH::KeyFactory.expects(:load_private_key).with(name, nil, false).raises(OpenSSL::PKey::RSAError).at_least_once
159
+ Net::SSH::KeyFactory.expects(:load_private_key).with(name, nil, true).never
160
+ else # :indifferently
161
+ Net::SSH::KeyFactory.expects(:load_private_key).with(name, nil, any_of(true, false)).returns(key).at_least_once
162
+ end
163
+
164
+ # do not override OpenSSL::PKey::EC#public_key
165
+ # (it will be called in transport/openssl.rb.)
166
+ unless defined?(OpenSSL::PKey::EC) && key.public_key.kind_of?(OpenSSL::PKey::EC::Point)
167
+ key.stubs(:public_key).returns(key)
168
+ end
169
+ end
170
+
171
+ def stub_file_public_key(name, key)
172
+ manager.add(name)
173
+ File.stubs(:readable?).with(name).returns(false)
174
+ File.stubs(:readable?).with(name + ".pub").returns(true)
175
+
176
+ Net::SSH::KeyFactory.expects(:load_public_key).with(name + ".pub").returns(key).at_least_once
177
+ end
178
+
179
+ def rsa(size=512)
180
+ @rsa ||= OpenSSL::PKey::RSA.new(size)
181
+ end
182
+
183
+ def dsa
184
+ @dsa ||= OpenSSL::PKey::DSA.new(512)
185
+ end
186
+
187
+ if defined?(OpenSSL::PKey::EC)
188
+ def ecdsa_sha2_nistp256
189
+ @ecdsa_sha2_nistp256 ||= OpenSSL::PKey::EC.new("prime256v1").generate_key
190
+ end
191
+
192
+ def ecdsa_sha2_nistp384
193
+ @ecdsa_sha2_nistp384 ||= OpenSSL::PKey::EC.new("secp384r1").generate_key
194
+ end
195
+
196
+ def ecdsa_sha2_nistp521
197
+ @ecdsa_sha2_nistp521 ||= OpenSSL::PKey::EC.new("secp521r1").generate_key
198
+ end
199
+ end
200
+
201
+ def agent
202
+ @agent ||= stub("agent", :identities => [rsa, dsa])
203
+ end
204
+
205
+ def agent_with_ecdsa_keys
206
+ @agent ||= stub("agent", :identities => [rsa, dsa,
207
+ ecdsa_sha2_nistp256,
208
+ ecdsa_sha2_nistp384,
209
+ ecdsa_sha2_nistp521])
210
+ end
211
+
212
+ def manager(options = {})
213
+ @manager ||= Net::SSH::Authentication::KeyManager.new(nil, options)
214
+ end
215
+
216
+ end
217
+
218
+ end