/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 4890078
* @summary Basic known-answer-test for RC2 and ARCFOUR
* @author Andreas Sterbenz
*/
public class CipherKAT {
if (b == null) {
return "(null)";
}
for (int i = 0; i < b.length; i++) {
int k = b[i] & 0xff;
if (i != 0) {
}
}
}
try {
int n = s.length();
StringReader r = new StringReader(s);
while (true) {
int b1 = nextNibble(r);
if (b1 < 0) {
break;
}
int b2 = nextNibble(r);
if (b2 < 0) {
throw new RuntimeException("Invalid string " + s);
}
}
return out.toByteArray();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public static byte[] b(String s) {
return parse(s);
}
while (true) {
if (ch == -1) {
return -1;
return ch - '0';
}
}
}
static abstract class Test {
}
private final byte[] plaintext;
private final byte[] ciphertext;
private final byte[] key;
private final byte[] iv;
this.ciphertext = ciphertext;
}
} else {
}
}
}
throw new Exception("Re-encryption test failed");
}
}
}
}
}
private static byte[] s(String s) {
try {
return s.getBytes("UTF8");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
private final static byte[] ALONG;
static {
}
t("RC4", "00", "74", "0123456789abcdef"),
t("RC4", "000102030405060708090a0b0c0d0e0f", "74:95:c0:e4:14:4e:0e:7e:05:42:df:58:3e:82:10:f3", "0123456789abcdef"),
t("RC4", "000102030405060708090a0b0c0d0e0f", "1b:34:61:29:05:0d:73:db:25:d0:dd:64:06:29:f6:8a", "0123456789"), // 40 bit
t("RC4", "000102030405060708090a0b0c0d0e0f", "ad:79:9d:98:d6:38:b1:f8:05:96:5c:e6:75:e7:82:24", "0123456789abcdeffedcba9876543210"), // 128 bit
t("RC4", "74:95:c0:e4:14:4e:0e:7e:05:42:df:58:3e:82:10:f3 1b:34:61:29:05:0d:73:db:25:d0:dd:64:06:29:f6:8a ad:79:9d:98:d6:38:b1:f8:05:96:5c:e6:75:e7:82:24 ad:79:9d:98:d6:38:b1:f8:05:96:5c:e6:75:e7:82:24",
"e1:15:95:fc:79:da:5e:a4:e4:2a:a8:ce:cd:7d:1e:f3:f7:ef:19:a5:05:70:9f:f7:59:49:44:d6:fb:5a:b6:54:04:4d:f8:e6:60:a3:96:7d:40:33:09:78:f2:2e:de:25:fe:ad:54:dd:b9:65:97:d6:d4:4c:a8:a6:f2:2c:13:61",
"1b:34:61:29:05:0d:73:db:25:d0:dd:64:06:29:f6:8a"),
"00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"),
"00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:01"),
"00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"),
"00:01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F"),
"39:88:F7:B8:6C:14:D3:F8:BA:B8:12:73:3E:2E:B7:EE"),
"1d:b2:cb:09:7f:e8:ab:43"),
};
}
}
}
}