1 /* $Id: TestTripleDES.java,v 1.8 2001/08/06 21:22:55 edwin Exp $ 2 * 3 * Copyright (C) 1995-1999 The Cryptix Foundation Limited. 4 * All rights reserved. 5 * 6 * Use, modification, copying and distribution of this software is subject 7 * the terms and conditions of the Cryptix General Licence. You should have 8 * received a copy of the Cryptix General Licence along with this library; 9 * if not, you can download a copy from http://www.cryptix.org/ . 10 */ 11 package cryptix.jce.test; 12 13 14 final class TestTripleDES 15 extends CipherTest 16 { 17 private static final String NAME="TripleDES"; 18 19 private static final String[][] TEST_VALUES = 20 { 21 // key ............................................ 22 // plain text ..... cipher text .... 23 // 24 { // same key ==> DES 25 "010101010101010101010101010101010101010101010101", 26 "95F8A5E5DD31D900", "8000000000000000" }, 27 { // same key ==> DES 28 "010101010101010101010101010101010101010101010101", 29 "9D64555A9A10B852", "0000001000000000" }, 30 { // same key ==> DES 31 "3849674C2602319E3849674C2602319E3849674C2602319E", 32 "51454B582DDF440A", "7178876E01F19B2A" }, 33 { // same key ==> DES 34 "04B915BA43FEB5B604B915BA43FEB5B604B915BA43FEB5B6", 35 "42FD443059577FA2", "AF37FB421F8C4095" }, 36 { // for checking first phase of below, defers to same 37 "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF", 38 "736F6D6564617461", "3D124FE2198BA318" }, 39 { // note k1 == k3 40 "0123456789ABCDEF55555555555555550123456789ABCDEF", 41 "736F6D6564617461", "FBABA1FF9D05E9B1" }, 42 { 43 "0123456789ABCDEF5555555555555555FEDCBA9876543210", 44 "736F6D6564617461", "18d748e563620572" }, 45 { 46 "0352020767208217860287665908219864056ABDFEA93457", 47 "7371756967676C65", "c07d2a0fa566fa30" }, 48 { // some of the weak(?) keys found in the test data 49 "010101010101010180010101010101010101010101010102", 50 "0000000000000000", "e6e6dd5b7e722974" }, 51 { // some of the weak(?) keys found in the test data 52 "10461034899880209107D0158919010119079210981A0101", 53 "0000000000000000", "e1ef62c332fe825b" }, 54 { // 168 bit key instead of 192 bit 55 "000000000000000000000000000000000000000000", 56 "95F8A5E5DD31D900", "8000000000000000" }, 57 { // 168 bit key instead of 192 bit 58 "000000000000000000000000000000000000000000", 59 "9D64555A9A10B852", "0000001000000000" }, 60 { // 168 bit key instead of 192 bit 61 "000000000000008000000000000000000000000001", 62 "0000000000000000", "e6e6dd5b7e722974" }, 63 }; 64 65 TestTripleDES()66 protected TestTripleDES() 67 { 68 super(NAME); 69 } 70 71 doIt()72 protected void doIt() 73 throws Exception 74 { 75 testExistence(NAME); 76 testExistence("DESede"); 77 testValuesECB(NAME, TEST_VALUES); 78 testKeyGenExistence(NAME); 79 testKeyGenWorks(NAME); 80 } 81 } 82