Source Code Cross Referenced for RC5Test.java in  » Security » Bouncy-Castle » org » bouncycastle » crypto » test » 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 » Security » Bouncy Castle » org.bouncycastle.crypto.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.bouncycastle.crypto.test;
002:
003:        import org.bouncycastle.crypto.engines.RC532Engine;
004:        import org.bouncycastle.crypto.engines.RC564Engine;
005:        import org.bouncycastle.crypto.modes.CBCBlockCipher;
006:        import org.bouncycastle.crypto.params.ParametersWithIV;
007:        import org.bouncycastle.crypto.params.RC5Parameters;
008:        import org.bouncycastle.util.encoders.Hex;
009:        import org.bouncycastle.util.test.SimpleTestResult;
010:        import org.bouncycastle.util.test.Test;
011:        import org.bouncycastle.util.test.TestResult;
012:
013:        /**
014:         * RC5 tester - vectors from ftp://ftp.nordu.net/rfc/rfc2040.txt
015:         *
016:         * RFC 2040 "The RC5, RC5-CBC, RC5-CBC-Pad, and RC5-CTS Algorithms"
017:         */
018:        public class RC5Test implements  Test {
019:            BlockCipherVectorTest[] tests = {
020:                    new BlockCipherVectorTest(0, new CBCBlockCipher(
021:                            new RC532Engine()), new ParametersWithIV(
022:                            new RC5Parameters(Hex.decode("00"), 0), Hex
023:                                    .decode("0000000000000000")),
024:                            "0000000000000000", "7a7bba4d79111d1e"),
025:                    new BlockCipherVectorTest(1, new CBCBlockCipher(
026:                            new RC532Engine()), new ParametersWithIV(
027:                            new RC5Parameters(Hex.decode("00"), 0), Hex
028:                                    .decode("0000000000000000")),
029:                            "ffffffffffffffff", "797bba4d78111d1e"),
030:                    new BlockCipherVectorTest(2, new CBCBlockCipher(
031:                            new RC532Engine()), new ParametersWithIV(
032:                            new RC5Parameters(Hex.decode("00"), 0), Hex
033:                                    .decode("0000000000000001")),
034:                            "0000000000000000", "7a7bba4d79111d1f"),
035:                    new BlockCipherVectorTest(3, new CBCBlockCipher(
036:                            new RC532Engine()), new ParametersWithIV(
037:                            new RC5Parameters(Hex.decode("00"), 0), Hex
038:                                    .decode("0000000000000000")),
039:                            "0000000000000001", "7a7bba4d79111d1f"),
040:                    new BlockCipherVectorTest(4, new CBCBlockCipher(
041:                            new RC532Engine()), new ParametersWithIV(
042:                            new RC5Parameters(Hex.decode("00"), 0), Hex
043:                                    .decode("0102030405060708")),
044:                            "1020304050607080", "8b9ded91ce7794a6"),
045:                    new BlockCipherVectorTest(5, new CBCBlockCipher(
046:                            new RC532Engine()), new ParametersWithIV(
047:                            new RC5Parameters(Hex.decode("11"), 1), Hex
048:                                    .decode("0000000000000000")),
049:                            "0000000000000000", "2f759fe7ad86a378"),
050:                    new BlockCipherVectorTest(6, new CBCBlockCipher(
051:                            new RC532Engine()), new ParametersWithIV(
052:                            new RC5Parameters(Hex.decode("00"), 2), Hex
053:                                    .decode("0000000000000000")),
054:                            "0000000000000000", "dca2694bf40e0788"),
055:                    new BlockCipherVectorTest(7, new CBCBlockCipher(
056:                            new RC532Engine()), new ParametersWithIV(
057:                            new RC5Parameters(Hex.decode("00000000"), 2), Hex
058:                                    .decode("0000000000000000")),
059:                            "0000000000000000", "dca2694bf40e0788"),
060:                    new BlockCipherVectorTest(8, new CBCBlockCipher(
061:                            new RC532Engine()), new ParametersWithIV(
062:                            new RC5Parameters(Hex.decode("00000000"), 8), Hex
063:                                    .decode("0000000000000000")),
064:                            "0000000000000000", "dcfe098577eca5ff"),
065:                    new BlockCipherVectorTest(9, new CBCBlockCipher(
066:                            new RC532Engine()), new ParametersWithIV(
067:                            new RC5Parameters(Hex.decode("00"), 8), Hex
068:                                    .decode("0102030405060708")),
069:                            "1020304050607080", "9646fb77638f9ca8"),
070:                    new BlockCipherVectorTest(10, new CBCBlockCipher(
071:                            new RC532Engine()), new ParametersWithIV(
072:                            new RC5Parameters(Hex.decode("00"), 12), Hex
073:                                    .decode("0102030405060708")),
074:                            "1020304050607080", "b2b3209db6594da4"),
075:                    new BlockCipherVectorTest(11, new CBCBlockCipher(
076:                            new RC532Engine()), new ParametersWithIV(
077:                            new RC5Parameters(Hex.decode("00"), 16), Hex
078:                                    .decode("0102030405060708")),
079:                            "1020304050607080", "545f7f32a5fc3836"),
080:                    new BlockCipherVectorTest(12, new CBCBlockCipher(
081:                            new RC532Engine()), new ParametersWithIV(
082:                            new RC5Parameters(Hex.decode("01020304"), 8), Hex
083:                                    .decode("0000000000000000")),
084:                            "ffffffffffffffff", "8285e7c1b5bc7402"),
085:                    new BlockCipherVectorTest(13, new CBCBlockCipher(
086:                            new RC532Engine()), new ParametersWithIV(
087:                            new RC5Parameters(Hex.decode("01020304"), 12), Hex
088:                                    .decode("0000000000000000")),
089:                            "ffffffffffffffff", "fc586f92f7080934"),
090:                    new BlockCipherVectorTest(14, new CBCBlockCipher(
091:                            new RC532Engine()), new ParametersWithIV(
092:                            new RC5Parameters(Hex.decode("01020304"), 16), Hex
093:                                    .decode("0000000000000000")),
094:                            "ffffffffffffffff", "cf270ef9717ff7c4"),
095:                    new BlockCipherVectorTest(15, new CBCBlockCipher(
096:                            new RC532Engine()), new ParametersWithIV(
097:                            new RC5Parameters(Hex.decode("0102030405060708"),
098:                                    12), Hex.decode("0000000000000000")),
099:                            "ffffffffffffffff", "e493f1c1bb4d6e8c"),
100:                    new BlockCipherVectorTest(16, new CBCBlockCipher(
101:                            new RC532Engine()),
102:                            new ParametersWithIV(new RC5Parameters(Hex
103:                                    .decode("0102030405060708"), 8), Hex
104:                                    .decode("0102030405060708")),
105:                            "1020304050607080", "5c4c041e0f217ac3"),
106:                    new BlockCipherVectorTest(17, new CBCBlockCipher(
107:                            new RC532Engine()), new ParametersWithIV(
108:                            new RC5Parameters(Hex.decode("0102030405060708"),
109:                                    12), Hex.decode("0102030405060708")),
110:                            "1020304050607080", "921f12485373b4f7"),
111:                    new BlockCipherVectorTest(18, new CBCBlockCipher(
112:                            new RC532Engine()), new ParametersWithIV(
113:                            new RC5Parameters(Hex.decode("0102030405060708"),
114:                                    16), Hex.decode("0102030405060708")),
115:                            "1020304050607080", "5ba0ca6bbe7f5fad"),
116:                    new BlockCipherVectorTest(
117:                            19,
118:                            new CBCBlockCipher(new RC532Engine()),
119:                            new ParametersWithIV(
120:                                    new RC5Parameters(
121:                                            Hex
122:                                                    .decode("01020304050607081020304050607080"),
123:                                            8), Hex.decode("0102030405060708")),
124:                            "1020304050607080", "c533771cd0110e63"),
125:                    new BlockCipherVectorTest(
126:                            20,
127:                            new CBCBlockCipher(new RC532Engine()),
128:                            new ParametersWithIV(
129:                                    new RC5Parameters(
130:                                            Hex
131:                                                    .decode("01020304050607081020304050607080"),
132:                                            12), Hex.decode("0102030405060708")),
133:                            "1020304050607080", "294ddb46b3278d60"),
134:                    new BlockCipherVectorTest(
135:                            21,
136:                            new CBCBlockCipher(new RC532Engine()),
137:                            new ParametersWithIV(
138:                                    new RC5Parameters(
139:                                            Hex
140:                                                    .decode("01020304050607081020304050607080"),
141:                                            16), Hex.decode("0102030405060708")),
142:                            "1020304050607080", "dad6bda9dfe8f7e8"),
143:                    new BlockCipherVectorTest(22, new CBCBlockCipher(
144:                            new RC532Engine()), new ParametersWithIV(
145:                            new RC5Parameters(Hex.decode("0102030405"), 12),
146:                            Hex.decode("0000000000000000")),
147:                            "ffffffffffffffff", "97e0787837ed317f"),
148:                    new BlockCipherVectorTest(23, new CBCBlockCipher(
149:                            new RC532Engine()), new ParametersWithIV(
150:                            new RC5Parameters(Hex.decode("0102030405"), 8), Hex
151:                                    .decode("0000000000000000")),
152:                            "ffffffffffffffff", "7875dbf6738c6478"),
153:                    new BlockCipherVectorTest(23, new CBCBlockCipher(
154:                            new RC532Engine()), new ParametersWithIV(
155:                            new RC5Parameters(Hex.decode("0102030405"), 8), Hex
156:                                    .decode("7875dbf6738c6478")),
157:                            "0808080808080808", "8f34c3c681c99695"),
158:                    new BlockCipherVectorTest(
159:                            640,
160:                            new CBCBlockCipher(new RC564Engine()),
161:                            new ParametersWithIV(new RC5Parameters(Hex
162:                                    .decode("00"), 0), Hex
163:                                    .decode("00000000000000000000000000000000")),
164:                            "00000000000000000000000000000000",
165:                            "9f09b98d3f6062d9d4d59973d00e0e63"),
166:                    new BlockCipherVectorTest(
167:                            641,
168:                            new CBCBlockCipher(new RC564Engine()),
169:                            new ParametersWithIV(new RC5Parameters(Hex
170:                                    .decode("00"), 0), Hex
171:                                    .decode("00000000000000000000000000000000")),
172:                            "ffffffffffffffffffffffffffffffff",
173:                            "9e09b98d3f6062d9d3d59973d00e0e63") };
174:
175:            public String getName() {
176:                return "RC5";
177:            }
178:
179:            public TestResult perform() {
180:                for (int i = 0; i != tests.length; i++) {
181:                    TestResult res = tests[i].perform();
182:
183:                    if (!res.isSuccessful()) {
184:                        return res;
185:                    }
186:                }
187:
188:                return new SimpleTestResult(true, getName() + ": Okay");
189:            }
190:
191:            public static void main(String[] args) {
192:                RC5Test test = new RC5Test();
193:                TestResult result = test.perform();
194:
195:                System.out.println(result);
196:            }
197:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.