Source Code Cross Referenced for DHGexParameters.java in  » Net » Ganymed-SSH-2 » ch » ethz » ssh2 » 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 » Ganymed SSH 2 » ch.ethz.ssh2 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package ch.ethz.ssh2;
002:
003:        /**
004:         * A <code>DHGexParameters</code> object can be used to specify parameters for
005:         * the diffie-hellman group exchange.
006:         * <p>
007:         * Depending on which constructor is used, either the use of a
008:         * <code>SSH_MSG_KEX_DH_GEX_REQUEST</code> or <code>SSH_MSG_KEX_DH_GEX_REQUEST_OLD</code>
009:         * can be forced.
010:         * 
011:         * @see Connection#setDHGexParameters(DHGexParameters)
012:         * @author Christian Plattner, plattner@inf.ethz.ch
013:         * @version $Id: DHGexParameters.java,v 1.3 2006/09/20 12:51:37 cplattne Exp $
014:         */
015:
016:        public class DHGexParameters {
017:            private final int min_group_len;
018:            private final int pref_group_len;
019:            private final int max_group_len;
020:
021:            private static final int MIN_ALLOWED = 1024;
022:            private static final int MAX_ALLOWED = 8192;
023:
024:            /**
025:             * Same as calling {@link #DHGexParameters(int, int, int) DHGexParameters(1024, 1024, 4096)}.
026:             * This is also the default used by the Connection class.
027:             * 
028:             */
029:            public DHGexParameters() {
030:                this (1024, 1024, 4096);
031:            }
032:
033:            /**
034:             * This constructor can be used to force the sending of a
035:             * <code>SSH_MSG_KEX_DH_GEX_REQUEST_OLD</code> request.
036:             * Internally, the minimum and maximum group lengths will
037:             * be set to zero.
038:             * 
039:             * @param pref_group_len has to be &gt= 1024 and &lt;= 8192
040:             */
041:            public DHGexParameters(int pref_group_len) {
042:                if ((pref_group_len < MIN_ALLOWED)
043:                        || (pref_group_len > MAX_ALLOWED))
044:                    throw new IllegalArgumentException(
045:                            "pref_group_len out of range!");
046:
047:                this .pref_group_len = pref_group_len;
048:                this .min_group_len = 0;
049:                this .max_group_len = 0;
050:            }
051:
052:            /**
053:             * This constructor can be used to force the sending of a
054:             * <code>SSH_MSG_KEX_DH_GEX_REQUEST</code> request.
055:             * <p>
056:             * Note: older OpenSSH servers don't understand this request, in which
057:             * case you should use the {@link #DHGexParameters(int)} constructor.
058:             * <p>
059:             * All values have to be &gt= 1024 and &lt;= 8192. Furthermore,
060:             * min_group_len &lt;= pref_group_len &lt;= max_group_len.
061:             * 
062:             * @param min_group_len
063:             * @param pref_group_len
064:             * @param max_group_len
065:             */
066:            public DHGexParameters(int min_group_len, int pref_group_len,
067:                    int max_group_len) {
068:                if ((min_group_len < MIN_ALLOWED)
069:                        || (min_group_len > MAX_ALLOWED))
070:                    throw new IllegalArgumentException(
071:                            "min_group_len out of range!");
072:
073:                if ((pref_group_len < MIN_ALLOWED)
074:                        || (pref_group_len > MAX_ALLOWED))
075:                    throw new IllegalArgumentException(
076:                            "pref_group_len out of range!");
077:
078:                if ((max_group_len < MIN_ALLOWED)
079:                        || (max_group_len > MAX_ALLOWED))
080:                    throw new IllegalArgumentException(
081:                            "max_group_len out of range!");
082:
083:                if ((pref_group_len < min_group_len)
084:                        || (pref_group_len > max_group_len))
085:                    throw new IllegalArgumentException(
086:                            "pref_group_len is incompatible with min and max!");
087:
088:                if (max_group_len < min_group_len)
089:                    throw new IllegalArgumentException(
090:                            "max_group_len must not be smaller than min_group_len!");
091:
092:                this .min_group_len = min_group_len;
093:                this .pref_group_len = pref_group_len;
094:                this .max_group_len = max_group_len;
095:            }
096:
097:            /**
098:             * Get the maximum group length.
099:             * 
100:             * @return the maximum group length, may be <code>zero</code> if
101:             *         SSH_MSG_KEX_DH_GEX_REQUEST_OLD should be requested
102:             */
103:            public int getMax_group_len() {
104:                return max_group_len;
105:            }
106:
107:            /**
108:             * Get the minimum group length.
109:             * 
110:             * @return minimum group length, may be <code>zero</code> if
111:             *         SSH_MSG_KEX_DH_GEX_REQUEST_OLD should be requested
112:             */
113:            public int getMin_group_len() {
114:                return min_group_len;
115:            }
116:
117:            /**
118:             * Get the preferred group length.
119:             * 
120:             * @return the preferred group length
121:             */
122:            public int getPref_group_len() {
123:                return pref_group_len;
124:            }
125:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.