Java Doc for AbstractKnownHostsKeyVerification.java in  » Net » j2ssh » com » sshtools » j2ssh » transport » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » j2ssh » com.sshtools.j2ssh.transport 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sshtools.j2ssh.transport.AbstractKnownHostsKeyVerification

All known Subclasses:   com.sshtools.common.hosts.DialogKnownHostsKeyVerification,  com.sshtools.j2ssh.transport.ConsoleKnownHostsKeyVerification,
AbstractKnownHostsKeyVerification
abstract public class AbstractKnownHostsKeyVerification implements HostKeyVerification(Code)

An abstract HostKeyVerification class providing validation against the known_hosts format.


author:
   Lee David Painter
version:
   $Revision: 1.18 $
since:
   0.2.0



Constructor Summary
public  AbstractKnownHostsKeyVerification(String knownhosts)
    

Constructs a host key verification instance reading the specified known_hosts file.


Method Summary
public  voidallowHost(String host, SshPublicKey pk, boolean always)
    

Allows a host key, optionally recording the key to the known_hosts file.

public  MapallowedHosts()
    

Returns a Map of the allowed hosts.

The keys of the returned Map are comma separated strings of "hostname,ipaddress".

public  booleanisHostFileWriteable()
    

Determines whether the host file is writable.

abstract public  voidonHostKeyMismatch(String host, SshPublicKey allowedHostKey, SshPublicKey actualHostKey)
    

Called by the verifyHost method when the host key supplied by the host does not match the current key recording in the known hosts file.

abstract public  voidonUnknownHost(String host, SshPublicKey key)
    

Called by the verifyHost method when the host key supplied is not recorded in the known_hosts file.

public  voidremoveAllowedHost(String host)
    

Removes an allowed host.

public  voidsaveHostFile()
    

Save's the host key file to be saved.

public  StringtoString()
    

Outputs the allowed hosts in the known_hosts file format.

The format consists of any number of lines each representing one key for a single host.

titan,192.168.1.12 ssh-dss AAAAB3NzaC1kc3MAAACBAP1/U4Ed..... titan,192.168.1.12 ssh-rsa AAAAB3NzaC1kc3MAAACBAP1/U4Ed..... einstein,192.168.1.40 ssh-dss AAAAB3NzaC1kc3MAAACBAP1/U4Ed.....
public  booleanverifyHost(String host, SshPublicKey pk)
    

Verifies a host key against the list of known_hosts.



Constructor Detail
AbstractKnownHostsKeyVerification
public AbstractKnownHostsKeyVerification(String knownhosts) throws InvalidHostFileException(Code)

Constructs a host key verification instance reading the specified known_hosts file.


Parameters:
  knownhosts - the path of the known_hosts file
throws:
  InvalidHostFileException - if the known_hosts file is invalid
since:
   0.2.0




Method Detail
allowHost
public void allowHost(String host, SshPublicKey pk, boolean always) throws InvalidHostFileException(Code)

Allows a host key, optionally recording the key to the known_hosts file.


Parameters:
  host - the name of the host
Parameters:
  pk - the public key to allow
Parameters:
  always - true if the key should be written to the known_hosts file
throws:
  InvalidHostFileException - if the host file cannot be written
since:
   0.2.0



allowedHosts
public Map allowedHosts()(Code)

Returns a Map of the allowed hosts.

The keys of the returned Map are comma separated strings of "hostname,ipaddress". The value objects are Maps containing a string key of the public key alogorithm name and the public key as the value.

the allowed hosts
since:
   0.2.0



isHostFileWriteable
public boolean isHostFileWriteable()(Code)

Determines whether the host file is writable.

true if the host file is writable, otherwise false
since:
   0.2.0



onHostKeyMismatch
abstract public void onHostKeyMismatch(String host, SshPublicKey allowedHostKey, SshPublicKey actualHostKey) throws TransportProtocolException(Code)

Called by the verifyHost method when the host key supplied by the host does not match the current key recording in the known hosts file.


Parameters:
  host - the name of the host
Parameters:
  allowedHostKey - the current key recorded in the known_hosts file.
Parameters:
  actualHostKey - the actual key supplied by the user
throws:
  TransportProtocolException - if an error occurs
since:
   0.2.0



onUnknownHost
abstract public void onUnknownHost(String host, SshPublicKey key) throws TransportProtocolException(Code)

Called by the verifyHost method when the host key supplied is not recorded in the known_hosts file.


Parameters:
  host - the name of the host
Parameters:
  key - the public key supplied by the host
throws:
  TransportProtocolException - if an error occurs
since:
   0.2.0



removeAllowedHost
public void removeAllowedHost(String host)(Code)

Removes an allowed host.


Parameters:
  host - the host to remove
since:
   0.2.0



saveHostFile
public void saveHostFile() throws InvalidHostFileException(Code)

Save's the host key file to be saved.


throws:
  InvalidHostFileException - if the host file is invalid
since:
   0.2.0



toString
public String toString()(Code)

Outputs the allowed hosts in the known_hosts file format.

The format consists of any number of lines each representing one key for a single host.

titan,192.168.1.12 ssh-dss AAAAB3NzaC1kc3MAAACBAP1/U4Ed..... titan,192.168.1.12 ssh-rsa AAAAB3NzaC1kc3MAAACBAP1/U4Ed..... einstein,192.168.1.40 ssh-dss AAAAB3NzaC1kc3MAAACBAP1/U4Ed.....
since:
   0.2.0



verifyHost
public boolean verifyHost(String host, SshPublicKey pk) throws TransportProtocolException(Code)

Verifies a host key against the list of known_hosts.

If the host unknown or the key does not match the currently allowed host key the abstract onUnknownHost or onHostKeyMismatch methods are called so that the caller may identify and allow the host.


Parameters:
  host - the name of the host
Parameters:
  pk - the host key supplied true if the host is accepted, otherwise false
throws:
  TransportProtocolException - if an error occurs
since:
   0.2.0



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.