Source Code Cross Referenced for CipherSuiteTest.java in  » Apache-Harmony-Java-SE » org-package » org » apache » harmony » xnet » provider » jsse » 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 » Apache Harmony Java SE » org package » org.apache.harmony.xnet.provider.jsse 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         */
017:
018:        package org.apache.harmony.xnet.provider.jsse;
019:
020:        import junit.framework.TestCase;
021:
022:        /**
023:         * Tests for <code>CipherSuite</code> constructor and methods
024:         * 
025:         */
026:        public class CipherSuiteTest extends TestCase {
027:
028:            public void testEquals() {
029:                CipherSuite c1 = new CipherSuite("CipherSuite1", false, 0, "",
030:                        "", new byte[] { 10, 10 });
031:                CipherSuite c2 = new CipherSuite("CipherSuite2", false, 0, "",
032:                        "", new byte[] { 10, 10 });
033:                CipherSuite c3 = new CipherSuite("CipherSuite3", false, 0, "",
034:                        "", new byte[] { 10, 11 });
035:                CipherSuite c4 = new CipherSuite("CipherSuite4", false, 0, "",
036:                        "", new byte[] { 11, 10 });
037:                if (!c1.equals(c2) || c1.equals(c3) || c4.equals(c1)
038:                        || c4.equals(c3)) {
039:                    fail("testEquals failed");
040:                }
041:            }
042:
043:            public void testToString() {
044:                CipherSuite c1 = new CipherSuite("CipherSuite1", false, 0, "",
045:                        "", new byte[] { 10, 10 });
046:                assertEquals("testToString failed", "CipherSuite1: 10 10", c1
047:                        .toString());
048:            }
049:
050:            public void testGetByName() {
051:                CipherSuite[] suites = CipherSuite.getSupported();
052:                for (int i = 0; i < suites.length; i++) {
053:                    assertEquals("incorrect cipher suite returned", suites[i],
054:                            CipherSuite.getByName(suites[i].getName()));
055:                }
056:                assertNull("non null cipher suite returned for name: SomeName",
057:                        CipherSuite.getByName("SomeName"));
058:            }
059:
060:            /*
061:             * Class under test for CipherSuite getByCode(byte, byte)
062:             */
063:            public void testGetByCodebytebyte() {
064:                CipherSuite[] suites = CipherSuite.getSupported();
065:                for (int i = 0; i < suites.length; i++) {
066:                    byte[] code = suites[i].toBytes();
067:                    assertEquals("incorrect cipher suite returned", suites[i],
068:                            CipherSuite.getByCode(code[0], code[1]));
069:                }
070:                assertEquals("incorrect cipher suite returned for code: 10 10",
071:                        new CipherSuite("UNKNOUN_10_10", false, 0, "", "",
072:                                new byte[] { 10, 10 }), CipherSuite.getByCode(
073:                                (byte) 10, (byte) 10));
074:            }
075:
076:            /*
077:             * Class under test for CipherSuite getByCode(byte, byte, byte)
078:             */
079:            public void testGetByCodebytebytebyte() {
080:                CipherSuite[] suites = CipherSuite.getSupported();
081:                for (int i = 0; i < suites.length; i++) {
082:                    byte[] code = suites[i].toBytes();
083:                    assertEquals("incorrect cipher suite returned", suites[i],
084:                            CipherSuite.getByCode((byte) 0, (byte) 0, code[1]));
085:                }
086:                assertEquals(
087:                        "incorrect cipher suite returned for code: 10 10 10",
088:                        new CipherSuite("UNKNOUN_10_10_10", false, 0, "", "",
089:                                new byte[] { 10, 10, 10 }), CipherSuite
090:                                .getByCode((byte) 10, (byte) 10, (byte) 10));
091:            }
092:
093:            public void testIsAnonymous() {
094:                CipherSuite c1 = new CipherSuite("CipherSuite1", false,
095:                        CipherSuite.KeyExchange_DH_anon, "", "", new byte[] {
096:                                10, 10 });
097:                CipherSuite c2 = new CipherSuite("CipherSuite2", false,
098:                        CipherSuite.KeyExchange_DH_anon_EXPORT, "", "",
099:                        new byte[] { 9, 10 });
100:                CipherSuite c3 = new CipherSuite("CipherSuite3", false,
101:                        CipherSuite.KeyExchange_DH_DSS, "", "", new byte[] {
102:                                10, 11 });
103:                CipherSuite c4 = new CipherSuite("CipherSuite4", false,
104:                        CipherSuite.KeyExchange_DH_RSA, "", "", new byte[] {
105:                                11, 10 });
106:                assertTrue(c1.isAnonymous());
107:                assertTrue(c1.isAnonymous());
108:                assertFalse(c3.isAnonymous());
109:                assertFalse(c4.isAnonymous());
110:            }
111:
112:            public void testGetSupported() {
113:                CipherSuite[] suites = CipherSuite.getSupported();
114:                for (int i = 0; i < suites.length; i++) {
115:                    assertTrue(suites[i].supported);
116:                }
117:            }
118:
119:            public void testGetSupportedCipherSuiteNames() {
120:                CipherSuite[] suites = CipherSuite.getSupported();
121:                String[] names = CipherSuite.getSupportedCipherSuiteNames();
122:                for (int i = 0; i < suites.length; i++) {
123:                    assertEquals(suites[i].getName(), names[i]);
124:                }
125:            }
126:
127:            public void testGetBulkEncryptionAlgorithm() {
128:                assertNull(CipherSuite.TLS_NULL_WITH_NULL_NULL
129:                        .getBulkEncryptionAlgorithm());
130:                assertNull(CipherSuite.TLS_RSA_WITH_NULL_MD5
131:                        .getBulkEncryptionAlgorithm());
132:                assertNull(CipherSuite.TLS_RSA_WITH_NULL_SHA
133:                        .getBulkEncryptionAlgorithm());
134:                assertEquals("RC4", CipherSuite.TLS_RSA_EXPORT_WITH_RC4_40_MD5
135:                        .getBulkEncryptionAlgorithm());
136:                assertEquals("RC4", CipherSuite.TLS_RSA_WITH_RC4_128_MD5
137:                        .getBulkEncryptionAlgorithm());
138:                assertEquals("RC4", CipherSuite.TLS_RSA_WITH_RC4_128_SHA
139:                        .getBulkEncryptionAlgorithm());
140:                assertEquals("RC2/CBC/NoPadding",
141:                        CipherSuite.TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5
142:                                .getBulkEncryptionAlgorithm());
143:                assertEquals("IDEA/CBC/NoPadding",
144:                        CipherSuite.TLS_RSA_WITH_IDEA_CBC_SHA
145:                                .getBulkEncryptionAlgorithm());
146:                assertEquals("DES/CBC/NoPadding",
147:                        CipherSuite.TLS_RSA_EXPORT_WITH_DES40_CBC_SHA
148:                                .getBulkEncryptionAlgorithm());
149:                assertEquals("DES/CBC/NoPadding",
150:                        CipherSuite.TLS_RSA_WITH_DES_CBC_SHA
151:                                .getBulkEncryptionAlgorithm());
152:                assertEquals("DESede/CBC/NoPadding",
153:                        CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA
154:                                .getBulkEncryptionAlgorithm());
155:                assertEquals("DES/CBC/NoPadding",
156:                        CipherSuite.TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA
157:                                .getBulkEncryptionAlgorithm());
158:                assertEquals("DES/CBC/NoPadding",
159:                        CipherSuite.TLS_DH_DSS_WITH_DES_CBC_SHA
160:                                .getBulkEncryptionAlgorithm());
161:                assertEquals("DESede/CBC/NoPadding",
162:                        CipherSuite.TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA
163:                                .getBulkEncryptionAlgorithm());
164:                assertEquals("DES/CBC/NoPadding",
165:                        CipherSuite.TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA
166:                                .getBulkEncryptionAlgorithm());
167:                assertEquals("DES/CBC/NoPadding",
168:                        CipherSuite.TLS_DH_RSA_WITH_DES_CBC_SHA
169:                                .getBulkEncryptionAlgorithm());
170:                assertEquals("DESede/CBC/NoPadding",
171:                        CipherSuite.TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA
172:                                .getBulkEncryptionAlgorithm());
173:                assertEquals("DES/CBC/NoPadding",
174:                        CipherSuite.TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
175:                                .getBulkEncryptionAlgorithm());
176:                assertEquals("DES/CBC/NoPadding",
177:                        CipherSuite.TLS_DHE_DSS_WITH_DES_CBC_SHA
178:                                .getBulkEncryptionAlgorithm());
179:                assertEquals("DESede/CBC/NoPadding",
180:                        CipherSuite.TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
181:                                .getBulkEncryptionAlgorithm());
182:                assertEquals("DES/CBC/NoPadding",
183:                        CipherSuite.TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
184:                                .getBulkEncryptionAlgorithm());
185:                assertEquals("DES/CBC/NoPadding",
186:                        CipherSuite.TLS_DHE_RSA_WITH_DES_CBC_SHA
187:                                .getBulkEncryptionAlgorithm());
188:                assertEquals("DESede/CBC/NoPadding",
189:                        CipherSuite.TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
190:                                .getBulkEncryptionAlgorithm());
191:                assertEquals("RC4",
192:                        CipherSuite.TLS_DH_anon_EXPORT_WITH_RC4_40_MD5
193:                                .getBulkEncryptionAlgorithm());
194:                assertEquals("RC4", CipherSuite.TLS_DH_anon_WITH_RC4_128_MD5
195:                        .getBulkEncryptionAlgorithm());
196:                assertEquals("DES/CBC/NoPadding",
197:                        CipherSuite.TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA
198:                                .getBulkEncryptionAlgorithm());
199:                assertEquals("DES/CBC/NoPadding",
200:                        CipherSuite.TLS_DH_anon_WITH_DES_CBC_SHA
201:                                .getBulkEncryptionAlgorithm());
202:                assertEquals("DESede/CBC/NoPadding",
203:                        CipherSuite.TLS_DH_anon_WITH_3DES_EDE_CBC_SHA
204:                                .getBulkEncryptionAlgorithm());
205:            }
206:
207:            public void testGetBlockSize() {
208:                assertEquals(0, CipherSuite.TLS_NULL_WITH_NULL_NULL
209:                        .getBlockSize());
210:                assertEquals(0, CipherSuite.TLS_RSA_WITH_NULL_MD5
211:                        .getBlockSize());
212:                assertEquals(0, CipherSuite.TLS_RSA_WITH_NULL_SHA
213:                        .getBlockSize());
214:                assertEquals(0, CipherSuite.TLS_RSA_EXPORT_WITH_RC4_40_MD5
215:                        .getBlockSize());
216:                assertEquals(0, CipherSuite.TLS_RSA_WITH_RC4_128_MD5
217:                        .getBlockSize());
218:                assertEquals(0, CipherSuite.TLS_RSA_WITH_RC4_128_SHA
219:                        .getBlockSize());
220:                assertEquals(8, CipherSuite.TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5
221:                        .getBlockSize());
222:                assertEquals(8, CipherSuite.TLS_RSA_WITH_IDEA_CBC_SHA
223:                        .getBlockSize());
224:                assertEquals(8, CipherSuite.TLS_RSA_EXPORT_WITH_DES40_CBC_SHA
225:                        .getBlockSize());
226:                assertEquals(8, CipherSuite.TLS_RSA_WITH_DES_CBC_SHA
227:                        .getBlockSize());
228:                assertEquals(8, CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA
229:                        .getBlockSize());
230:                assertEquals(8,
231:                        CipherSuite.TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA
232:                                .getBlockSize());
233:                assertEquals(8, CipherSuite.TLS_DH_DSS_WITH_DES_CBC_SHA
234:                        .getBlockSize());
235:                assertEquals(8, CipherSuite.TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA
236:                        .getBlockSize());
237:                assertEquals(8,
238:                        CipherSuite.TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA
239:                                .getBlockSize());
240:                assertEquals(8, CipherSuite.TLS_DH_RSA_WITH_DES_CBC_SHA
241:                        .getBlockSize());
242:                assertEquals(8, CipherSuite.TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA
243:                        .getBlockSize());
244:                assertEquals(8,
245:                        CipherSuite.TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
246:                                .getBlockSize());
247:                assertEquals(8, CipherSuite.TLS_DHE_DSS_WITH_DES_CBC_SHA
248:                        .getBlockSize());
249:                assertEquals(8, CipherSuite.TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
250:                        .getBlockSize());
251:                assertEquals(8,
252:                        CipherSuite.TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
253:                                .getBlockSize());
254:                assertEquals(8, CipherSuite.TLS_DHE_RSA_WITH_DES_CBC_SHA
255:                        .getBlockSize());
256:                assertEquals(8, CipherSuite.TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
257:                        .getBlockSize());
258:                assertEquals(0, CipherSuite.TLS_DH_anon_EXPORT_WITH_RC4_40_MD5
259:                        .getBlockSize());
260:                assertEquals(0, CipherSuite.TLS_DH_anon_WITH_RC4_128_MD5
261:                        .getBlockSize());
262:                assertEquals(8,
263:                        CipherSuite.TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA
264:                                .getBlockSize());
265:                assertEquals(8, CipherSuite.TLS_DH_anon_WITH_DES_CBC_SHA
266:                        .getBlockSize());
267:                assertEquals(8, CipherSuite.TLS_DH_anon_WITH_3DES_EDE_CBC_SHA
268:                        .getBlockSize());
269:            }
270:
271:            public void testGetHmacName() {
272:                assertNull(CipherSuite.TLS_NULL_WITH_NULL_NULL.getHmacName());
273:                assertEquals("HmacMD5", CipherSuite.TLS_RSA_WITH_NULL_MD5
274:                        .getHmacName());
275:                assertEquals("HmacSHA1", CipherSuite.TLS_RSA_WITH_NULL_SHA
276:                        .getHmacName());
277:                assertEquals("HmacMD5",
278:                        CipherSuite.TLS_RSA_EXPORT_WITH_RC4_40_MD5
279:                                .getHmacName());
280:                assertEquals("HmacMD5", CipherSuite.TLS_RSA_WITH_RC4_128_MD5
281:                        .getHmacName());
282:                assertEquals("HmacSHA1", CipherSuite.TLS_RSA_WITH_RC4_128_SHA
283:                        .getHmacName());
284:                assertEquals("HmacMD5",
285:                        CipherSuite.TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5
286:                                .getHmacName());
287:                assertEquals("HmacSHA1", CipherSuite.TLS_RSA_WITH_IDEA_CBC_SHA
288:                        .getHmacName());
289:                assertEquals("HmacSHA1",
290:                        CipherSuite.TLS_RSA_EXPORT_WITH_DES40_CBC_SHA
291:                                .getHmacName());
292:                assertEquals("HmacSHA1", CipherSuite.TLS_RSA_WITH_DES_CBC_SHA
293:                        .getHmacName());
294:                assertEquals("HmacSHA1",
295:                        CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA.getHmacName());
296:                assertEquals("HmacSHA1",
297:                        CipherSuite.TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA
298:                                .getHmacName());
299:                assertEquals("HmacSHA1",
300:                        CipherSuite.TLS_DH_DSS_WITH_DES_CBC_SHA.getHmacName());
301:                assertEquals("HmacSHA1",
302:                        CipherSuite.TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA
303:                                .getHmacName());
304:                assertEquals("HmacSHA1",
305:                        CipherSuite.TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA
306:                                .getHmacName());
307:                assertEquals("HmacSHA1",
308:                        CipherSuite.TLS_DH_RSA_WITH_DES_CBC_SHA.getHmacName());
309:                assertEquals("HmacSHA1",
310:                        CipherSuite.TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA
311:                                .getHmacName());
312:                assertEquals("HmacSHA1",
313:                        CipherSuite.TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
314:                                .getHmacName());
315:                assertEquals("HmacSHA1",
316:                        CipherSuite.TLS_DHE_DSS_WITH_DES_CBC_SHA.getHmacName());
317:                assertEquals("HmacSHA1",
318:                        CipherSuite.TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
319:                                .getHmacName());
320:                assertEquals("HmacSHA1",
321:                        CipherSuite.TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
322:                                .getHmacName());
323:                assertEquals("HmacSHA1",
324:                        CipherSuite.TLS_DHE_RSA_WITH_DES_CBC_SHA.getHmacName());
325:                assertEquals("HmacSHA1",
326:                        CipherSuite.TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
327:                                .getHmacName());
328:                assertEquals("HmacMD5",
329:                        CipherSuite.TLS_DH_anon_EXPORT_WITH_RC4_40_MD5
330:                                .getHmacName());
331:                assertEquals("HmacMD5",
332:                        CipherSuite.TLS_DH_anon_WITH_RC4_128_MD5.getHmacName());
333:                assertEquals("HmacSHA1",
334:                        CipherSuite.TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA
335:                                .getHmacName());
336:                assertEquals("HmacSHA1",
337:                        CipherSuite.TLS_DH_anon_WITH_DES_CBC_SHA.getHmacName());
338:                assertEquals("HmacSHA1",
339:                        CipherSuite.TLS_DH_anon_WITH_3DES_EDE_CBC_SHA
340:                                .getHmacName());
341:            }
342:
343:            public void testGetHashName() {
344:                assertNull(CipherSuite.TLS_NULL_WITH_NULL_NULL.getHashName());
345:                assertEquals("MD5", CipherSuite.TLS_RSA_WITH_NULL_MD5
346:                        .getHashName());
347:                assertEquals("SHA-1", CipherSuite.TLS_RSA_WITH_NULL_SHA
348:                        .getHashName());
349:                assertEquals("MD5", CipherSuite.TLS_RSA_EXPORT_WITH_RC4_40_MD5
350:                        .getHashName());
351:                assertEquals("MD5", CipherSuite.TLS_RSA_WITH_RC4_128_MD5
352:                        .getHashName());
353:                assertEquals("SHA-1", CipherSuite.TLS_RSA_WITH_RC4_128_SHA
354:                        .getHashName());
355:                assertEquals("MD5",
356:                        CipherSuite.TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5
357:                                .getHashName());
358:                assertEquals("SHA-1", CipherSuite.TLS_RSA_WITH_IDEA_CBC_SHA
359:                        .getHashName());
360:                assertEquals("SHA-1",
361:                        CipherSuite.TLS_RSA_EXPORT_WITH_DES40_CBC_SHA
362:                                .getHashName());
363:                assertEquals("SHA-1", CipherSuite.TLS_RSA_WITH_DES_CBC_SHA
364:                        .getHashName());
365:                assertEquals("SHA-1", CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA
366:                        .getHashName());
367:                assertEquals("SHA-1",
368:                        CipherSuite.TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA
369:                                .getHashName());
370:                assertEquals("SHA-1", CipherSuite.TLS_DH_DSS_WITH_DES_CBC_SHA
371:                        .getHashName());
372:                assertEquals("SHA-1",
373:                        CipherSuite.TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA
374:                                .getHashName());
375:                assertEquals("SHA-1",
376:                        CipherSuite.TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA
377:                                .getHashName());
378:                assertEquals("SHA-1", CipherSuite.TLS_DH_RSA_WITH_DES_CBC_SHA
379:                        .getHashName());
380:                assertEquals("SHA-1",
381:                        CipherSuite.TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA
382:                                .getHashName());
383:                assertEquals("SHA-1",
384:                        CipherSuite.TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
385:                                .getHashName());
386:                assertEquals("SHA-1", CipherSuite.TLS_DHE_DSS_WITH_DES_CBC_SHA
387:                        .getHashName());
388:                assertEquals("SHA-1",
389:                        CipherSuite.TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
390:                                .getHashName());
391:                assertEquals("SHA-1",
392:                        CipherSuite.TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
393:                                .getHashName());
394:                assertEquals("SHA-1", CipherSuite.TLS_DHE_RSA_WITH_DES_CBC_SHA
395:                        .getHashName());
396:                assertEquals("SHA-1",
397:                        CipherSuite.TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
398:                                .getHashName());
399:                assertEquals("MD5",
400:                        CipherSuite.TLS_DH_anon_EXPORT_WITH_RC4_40_MD5
401:                                .getHashName());
402:                assertEquals("MD5", CipherSuite.TLS_DH_anon_WITH_RC4_128_MD5
403:                        .getHashName());
404:                assertEquals("SHA-1",
405:                        CipherSuite.TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA
406:                                .getHashName());
407:                assertEquals("SHA-1", CipherSuite.TLS_DH_anon_WITH_DES_CBC_SHA
408:                        .getHashName());
409:                assertEquals("SHA-1",
410:                        CipherSuite.TLS_DH_anon_WITH_3DES_EDE_CBC_SHA
411:                                .getHashName());
412:            }
413:
414:            public void testGetMACLength() {
415:                assertEquals(0, CipherSuite.TLS_NULL_WITH_NULL_NULL
416:                        .getMACLength());
417:                assertEquals(16, CipherSuite.TLS_RSA_WITH_NULL_MD5
418:                        .getMACLength());
419:                assertEquals(20, CipherSuite.TLS_RSA_WITH_NULL_SHA
420:                        .getMACLength());
421:                assertEquals(16, CipherSuite.TLS_RSA_EXPORT_WITH_RC4_40_MD5
422:                        .getMACLength());
423:                assertEquals(16, CipherSuite.TLS_RSA_WITH_RC4_128_MD5
424:                        .getMACLength());
425:                assertEquals(20, CipherSuite.TLS_RSA_WITH_RC4_128_SHA
426:                        .getMACLength());
427:                assertEquals(16, CipherSuite.TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5
428:                        .getMACLength());
429:                assertEquals(20, CipherSuite.TLS_RSA_WITH_IDEA_CBC_SHA
430:                        .getMACLength());
431:                assertEquals(20, CipherSuite.TLS_RSA_EXPORT_WITH_DES40_CBC_SHA
432:                        .getMACLength());
433:                assertEquals(20, CipherSuite.TLS_RSA_WITH_DES_CBC_SHA
434:                        .getMACLength());
435:                assertEquals(20, CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA
436:                        .getMACLength());
437:                assertEquals(20,
438:                        CipherSuite.TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA
439:                                .getMACLength());
440:                assertEquals(20, CipherSuite.TLS_DH_DSS_WITH_DES_CBC_SHA
441:                        .getMACLength());
442:                assertEquals(20, CipherSuite.TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA
443:                        .getMACLength());
444:                assertEquals(20,
445:                        CipherSuite.TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA
446:                                .getMACLength());
447:                assertEquals(20, CipherSuite.TLS_DH_RSA_WITH_DES_CBC_SHA
448:                        .getMACLength());
449:                assertEquals(20, CipherSuite.TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA
450:                        .getMACLength());
451:                assertEquals(20,
452:                        CipherSuite.TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
453:                                .getMACLength());
454:                assertEquals(20, CipherSuite.TLS_DHE_DSS_WITH_DES_CBC_SHA
455:                        .getMACLength());
456:                assertEquals(20, CipherSuite.TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
457:                        .getMACLength());
458:                assertEquals(20,
459:                        CipherSuite.TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
460:                                .getMACLength());
461:                assertEquals(20, CipherSuite.TLS_DHE_RSA_WITH_DES_CBC_SHA
462:                        .getMACLength());
463:                assertEquals(20, CipherSuite.TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
464:                        .getMACLength());
465:                assertEquals(16, CipherSuite.TLS_DH_anon_EXPORT_WITH_RC4_40_MD5
466:                        .getMACLength());
467:                assertEquals(16, CipherSuite.TLS_DH_anon_WITH_RC4_128_MD5
468:                        .getMACLength());
469:                assertEquals(20,
470:                        CipherSuite.TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA
471:                                .getMACLength());
472:                assertEquals(20, CipherSuite.TLS_DH_anon_WITH_DES_CBC_SHA
473:                        .getMACLength());
474:                assertEquals(20, CipherSuite.TLS_DH_anon_WITH_3DES_EDE_CBC_SHA
475:                        .getMACLength());
476:            }
477:
478:            public void testIsExportable() {
479:                assertTrue(CipherSuite.TLS_NULL_WITH_NULL_NULL.isExportable());
480:                assertTrue(CipherSuite.TLS_RSA_WITH_NULL_MD5.isExportable());
481:                assertTrue(CipherSuite.TLS_RSA_WITH_NULL_SHA.isExportable());
482:                assertTrue(CipherSuite.TLS_RSA_EXPORT_WITH_RC4_40_MD5
483:                        .isExportable());
484:                assertFalse(CipherSuite.TLS_RSA_WITH_RC4_128_MD5.isExportable());
485:                assertFalse(CipherSuite.TLS_RSA_WITH_RC4_128_SHA.isExportable());
486:                assertTrue(CipherSuite.TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5
487:                        .isExportable());
488:                assertFalse(CipherSuite.TLS_RSA_WITH_IDEA_CBC_SHA
489:                        .isExportable());
490:                assertTrue(CipherSuite.TLS_RSA_EXPORT_WITH_DES40_CBC_SHA
491:                        .isExportable());
492:                assertFalse(CipherSuite.TLS_RSA_WITH_DES_CBC_SHA.isExportable());
493:                assertFalse(CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA
494:                        .isExportable());
495:                assertTrue(CipherSuite.TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA
496:                        .isExportable());
497:                assertFalse(CipherSuite.TLS_DH_DSS_WITH_DES_CBC_SHA
498:                        .isExportable());
499:                assertFalse(CipherSuite.TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA
500:                        .isExportable());
501:                assertTrue(CipherSuite.TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA
502:                        .isExportable());
503:                assertFalse(CipherSuite.TLS_DH_RSA_WITH_DES_CBC_SHA
504:                        .isExportable());
505:                assertFalse(CipherSuite.TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA
506:                        .isExportable());
507:                assertTrue(CipherSuite.TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA
508:                        .isExportable());
509:                assertFalse(CipherSuite.TLS_DHE_DSS_WITH_DES_CBC_SHA
510:                        .isExportable());
511:                assertFalse(CipherSuite.TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
512:                        .isExportable());
513:                assertTrue(CipherSuite.TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
514:                        .isExportable());
515:                assertFalse(CipherSuite.TLS_DHE_RSA_WITH_DES_CBC_SHA
516:                        .isExportable());
517:                assertFalse(CipherSuite.TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
518:                        .isExportable());
519:                assertTrue(CipherSuite.TLS_DH_anon_EXPORT_WITH_RC4_40_MD5
520:                        .isExportable());
521:                assertFalse(CipherSuite.TLS_DH_anon_WITH_RC4_128_MD5
522:                        .isExportable());
523:                assertTrue(CipherSuite.TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA
524:                        .isExportable());
525:                assertFalse(CipherSuite.TLS_DH_anon_WITH_DES_CBC_SHA
526:                        .isExportable());
527:                assertFalse(CipherSuite.TLS_DH_anon_WITH_3DES_EDE_CBC_SHA
528:                        .isExportable());
529:            }
530:
531:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.