mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
8342188: Update tests to use stronger key parameters and certificates
Backport-of: ae82cc1ba1
This commit is contained in:
committed by
Vitaly Provodin
parent
340209fea6
commit
7b6bb3036d
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -101,20 +101,28 @@ public class TestRSA {
|
||||
}
|
||||
|
||||
private final static BigInteger N = new BigInteger
|
||||
("116231208661367609700141079576488663663527180869991078124978203037949869"
|
||||
+"312762870627991319537001781149083155962615105864954367253799351549459177"
|
||||
+"839995715202060014346744789001273681801687605044315560723525700773069112"
|
||||
+"214443196787519930666193675297582113726306864236010438506452172563580739"
|
||||
+"994193451997175316921");
|
||||
("188266606413163647033284152746165049309898453322378171182320013745371408"
|
||||
+"184225151227340555539225381200565037956400694325061098310480360339435446"
|
||||
+"755336872372614880713694669514510970895097323213784523223711244354375506"
|
||||
+"545371740274561954822416119304686041493350049135717091225288845575963270"
|
||||
+"990119098295690603875646206002898855577388327774594330896529948536446408"
|
||||
+"529165060686851725546480612209956477350581924733034990053737541249952501"
|
||||
+"521769091148873248215142518797910690254486909784694829645856181407041627"
|
||||
+"170373444275842961547787746324163594572697634605250977434548015081503826"
|
||||
+"85269006571608614747965903308253511034583");
|
||||
|
||||
private final static BigInteger E = BigInteger.valueOf(65537);
|
||||
|
||||
private final static BigInteger D = new BigInteger
|
||||
("528278531576995741358027120152717979850387435582102361125581844437708890"
|
||||
+"736418759997555187916546691958396015481089485084669078137376029510618510"
|
||||
+"203389286674134146181629472813419906337170366867244770096128371742241254"
|
||||
+"843638089774095747779777512895029847721754360216404183209801002443859648"
|
||||
+"26168432372077852785");
|
||||
("559658959270449023652159986632594861346314765962941829914811303419116045"
|
||||
+"486272857832294696380057096672262714220410818939360476461317579410769250"
|
||||
+"330981320689411092912185059149606517928125605236733543203155054153225543"
|
||||
+"370812803235323701309554652228655108862291812277980776744407549833834128"
|
||||
+"186640306349843950814414209051640048163781518404082259622597528271617305"
|
||||
+"214590875955949331568915021275293633454662841999317653268823194135508673"
|
||||
+"577887397954709453731172900970199673444683653554380810128925964066225098"
|
||||
+"009484055412274405773246950554037029408478181447349886871279557912030178"
|
||||
+"079306593910311097342934485929224862873");
|
||||
|
||||
private final static Random RANDOM = new Random();
|
||||
|
||||
@@ -154,16 +162,16 @@ public class TestRSA {
|
||||
}
|
||||
|
||||
private final static String in2 = "0f:7d:6c:20:75:99:a5:bc:c1:53:b0:4e:8d:ef:98:fb:cf:2d:e5:1d:d4:bf:71:56:12:b7:a3:c3:e4:53:1b:07:d3:bb:94:a7:a7:28:75:1e:83:46:c9:80:4e:3f:ac:b2:47:06:9f:1b:68:38:73:b8:69:9e:6b:8b:8b:23:60:31:ae:ea:36:24:6f:85:af:de:a5:2a:88:7d:6a:9f:8a:9f:61:f6:59:3f:a8:ce:91:75:49:e9:34:b8:9f:b6:21:8c";
|
||||
private final static String out2 = "7d:84:d1:3a:dc:ac:46:09:3a:0c:e5:4b:85:5d:fa:bb:52:f1:0f:de:d9:87:ef:b3:f7:c8:e3:9a:29:be:e9:b5:51:57:fd:07:5b:3c:1c:1c:56:aa:0c:a6:3f:79:40:16:ee:2c:2c:2e:fe:b8:3e:fd:45:90:1c:e7:87:1d:0a:0a:c5:de:9d:2b:a9:dd:77:d2:89:ba:98:fe:78:5b:a3:91:b4:ac:b5:ae:ce:45:21:f7:74:97:3e:a9:58:59:bc:14:13:02:3f:09:7b:97:90:b3:bd:53:cb:15:c0:6e:36:ea:d4:a3:3e:fc:94:85:a9:66:7f:57:b4:2a:ae:70:2e:fb";
|
||||
private final static String out2 = "4d:17:15:23:d9:f6:97:4d:4b:5b:9b:37:bd:a7:c5:33:b9:40:1f:c4:63:fa:7c:2a:fb:19:0b:d8:c4:3a:bd:e7:46:6b:1b:09:20:93:39:7c:e5:5f:7b:83:a7:a6:f6:f5:42:20:e7:7f:d3:14:9a:14:25:f9:31:9e:3c:c9:04:20:be:31:ac:77:45:37:4d:76:1b:10:3a:aa:42:c7:df:4c:61:a4:35:4d:28:41:c2:f9:b7:ce:00:94:42:06:c7:35:06:ca:f2:9e:96:c3:89:54:10:82:d8:de:f3:6c:23:8c:47:41:5a:13:fa:33:e0:a5:7f:ec:43:5d:b0:ea:c9:43:17:72:73:ce:11:48:fb:19:ee:13:6a:92:13:06:5c:55:dc:9e:86:b9:fb:44:62:44:9e:a9:e8:bd:6a:c0:c1:64:4b:fd:a9:5d:ef:59:1e:16:fe:64:c1:07:31:9e:9f:4d:4e:28:34:ea:39:e0:65:68:d4:8b:02:0b:8b:ed:bb:a6:a6:4a:29:b9:b5:08:f3:7a:a8:fd:03:3e:0d:d0:9e:25:47:2c:45:f2:40:39:58:e8:95:64:04:2b:50:1e:a5:ff:00:a4:cf:a9:13:4b:17:3a:e8:d1:2c:c1:4a:ab:1c:07:b4:b5:f6:c9:3f:38:48:89:55:59:00:c1:25:c9:d7:68";
|
||||
|
||||
private final static String in1 = "17:a3:a7:b1:86:29:06:c5:81:33:cd:2f:da:32:7c:0e:26:a8:18:aa:37:9b:dd:4a:b0:b0:a7:1c:14:82:6c:d9:c9:14:9f:55:19:91:02:0d:d9:d7:95:c2:2b:a6:fa:ba:a3:51:00:83:6b:ec:97:27:40:a3:8f:ba:b1:09:15:11:44:33:c6:3c:47:95:50:71:50:5a:f4:aa:00:4e:b9:48:6a:b1:34:e9:d0:c8:b8:92:bf:95:f3:3d:91:66:93:2b";
|
||||
private final static String out1 = "28:b7:b4:73:f2:16:11:c0:67:70:96:ee:dc:3e:23:87:9f:30:a7:e5:f0:db:aa:67:33:27:0e:75:79:af:29:f5:88:3d:93:22:14:d2:59:b4:eb:ce:95:7f:24:74:df:f2:aa:4d:e6:65:5a:63:6d:64:30:ef:31:f1:a6:df:17:42:b6:d1:ed:22:1f:b0:96:69:9d:f8:ce:ff:3a:47:96:51:ba:d9:8d:57:39:40:dc:fc:d3:03:92:39:f4:dd:4b:1b:07:8b:33:60:27:2d:5f:c6:cf:17:92:c6:12:69:a3:54:2e:b8:0f:ca:d9:46:0f:da:95:34:d0:84:35:9c:f6:44";
|
||||
private final static String out1 = "18:6d:d2:89:43:cb:ec:5c:ff:3d:fd:d5:23:2d:aa:fc:db:a7:63:5f:c7:2d:6f:81:c2:9f:aa:47:ed:fc:79:39:8a:6d:8f:c3:d0:f9:64:c3:e1:5f:1a:b3:20:03:1e:8a:3a:c5:58:ef:78:6b:fc:50:98:0a:11:d3:30:d9:68:44:9b:93:a6:b3:92:8f:09:0c:7a:d0:64:ac:e2:c7:b5:6a:37:35:00:3b:4e:d7:64:fb:54:c2:54:90:b9:71:6a:48:c4:6c:1e:e4:e6:4c:3f:fc:34:69:16:b9:53:8c:9f:30:4e:2e:7e:9c:fb:5f:26:18:c0:6e:69:32:18:30:40:59:8c:d1:c2:7a:41:75:06:9d:1c:0f:14:74:a9:f0:47:3a:97:0d:c4:c6:3f:24:ee:ed:c5:f8:2c:b6:ae:1d:e5:64:33:cd:e1:e0:21:d6:10:c0:8b:59:06:59:81:73:28:b4:f4:ef:fa:e8:67:a8:65:a5:e4:3c:c3:7e:99:f8:55:7a:e9:0d:41:3a:bf:c1:8c:41:f3:71:32:b6:c0:05:8b:91:8a:90:35:60:95:52:78:8e:a7:e5:a9:a1:bf:a3:de:55:c6:02:03:d5:98:01:59:fb:91:da:37:9e:3f:39:85:e1:3f:79:23:6c:0e:68:25:4c:13:3a:52:a2:f8:d9:4c:ce";
|
||||
|
||||
private final static String rin1 = "09:01:06:53:a7:96:09:63:ef:e1:3f:e9:8d:95:22:d1:0e:1b:87:c1:a2:41:b2:09:97:a3:5e:e0:a4:1d:59:91:21:e4:ca:87:bf:77:4a:7e:a2:22:ff:59:1e:bd:a4:80:aa:93:4a:41:56:95:5b:f4:57:df:fc:52:2f:46:9b:45:d7:03:ae:22:8e:67:9e:6c:b9:95:4f:bd:8e:e8:67:90:5b:fe:de:2f:11:22:2e:9d:30:93:6d:c0:48:00:cb:08:b9:c4:36:e9:03:7c:08:2d:68:42:cb:71:d0:7d:47:22:c1:58:c5:b8:2f:28:3e:98:78:11:6d:71:5b:3b:36:3c";
|
||||
private final static String rout1 = "4a:21:64:20:56:5f:27:0c:90:1d:f3:1b:64:8e:16:d3:af:79:ca:c6:65:56:19:77:8f:25:35:70:be:f3:15:b3:e3:d8:8f:04:ec:c3:60:59:d0:9a:66:be:1c:ad:f7:09:46:a9:09:46:12:5f:28:b6:28:b1:53:fb:fe:07:73:b8:8b:f8:83:64:8e:2d:45:ca:1a:fd:85:4a:2c:fa:fc:e6:58:f7:e4:83:68:8c:38:49:2b:f3:5c:c1:2d:24:6a:cd:22:6d:cb:f4:f1:8c:9e:1a:94:a7:4b:6f:d1:b4:b4:ab:56:8b:a3:a9:89:88:c3:5d:a8:47:2a:67:50:32:71:19";
|
||||
private final static String rin1 = "09:01:06:53:a7:96:09:63:ef:e1:3f:e9:8d:95:22:d1:0e:1b:87:c1:a2:41:b2:09:97:a3:5e:e0:a4:1d:59:91:21:e4:ca:87:bf:77:4a:7e:a2:22:ff:59:1e:bd:a4:80:aa:93:4a:41:56:95:5b:f4:57:df:fc:52:2f:46:9b:45:d7:03:ae:22:8e:67:9e:6c:b9:95:4f:bd:8e:e8:67:90:5b:fe:de:2f:11:22:2e:9d:30:93:6d:c0:48:00:cb:08:b9:c4:36:e9:03:7c:08:2d:68:42:cb:71:d0:7d:47:22:c1:58:c5:b8:2f:28:3e:98:78:11:6d:71:5b:3b:36:3c:09:01:06:53:a7:96:09:63:ef:e1:3f:e9:8d:95:22:d1:0e:1b:87:c1:a2:41:b2:09:97:a3:5e:e0:a4:1d:59:91:21:e4:ca:87:bf:77:4a:7e:a2:22:ff:59:1e:bd:a4:80:aa:93:4a:41:56:95:5b:f4:57:df:fc:52:2f:46:9b:45:d7:03:ae:22:8e:67:9e:6c:b9:95:4f:bd:8e:e8:67:90:5b:fe:de:2f:11:22:2e:9d:30:93:6d:c0:48:00:cb:08:b9:c4:36:e9:03:7c:08:2d:68:42:cb:71:d0:7d:47:22:c1:58:c5:b8:2f:28:3e:98:78:11:6d:71:5b:3b:36:3c";
|
||||
private final static String rout1 = "19:dd:a2:f9:57:d4:6b:60:85:ec:2d:5d:f9:64:f8:a0:c0:33:36:a2:8c:59:0f:74:9b:62:a8:ad:42:ed:be:34:0e:dc:13:db:d5:b9:aa:64:38:35:18:d7:6c:1d:da:5b:ff:f2:98:f5:fc:67:36:fb:9f:84:df:84:a3:af:ce:02:e5:05:ca:a7:e4:29:c0:5c:55:6a:8d:dc:8f:f7:6e:d4:ee:2e:6c:5b:ea:f8:bf:4c:7d:5f:af:6a:c3:77:02:80:33:be:13:4c:98:cf:dc:aa:e8:7d:73:69:6e:30:2c:35:c5:90:83:45:0d:64:04:af:b6:94:c3:a8:e2:d4:08:98:1d:b1:73:e3:fc:10:1f:71:0f:d0:13:f3:58:80:c4:a3:a9:02:52:cf:aa:41:b6:9b:69:33:9d:2a:d6:f6:02:07:ec:ce:19:01:f1:2f:90:27:fe:00:a5:d7:8d:01:97:36:fd:88:34:2f:f3:ab:38:ed:9d:69:91:af:b2:0d:ca:92:ca:9e:e7:24:37:d6:e3:c7:02:30:69:5b:ea:b4:b2:68:5f:4e:8c:cc:fd:bb:2e:96:2f:a3:c6:f7:71:93:24:5c:ca:8f:bc:f9:d8:bd:d3:b9:d1:16:ba:5a:ac:62:41:b4:d8:56:45:74:55:c2:a5:ef:23:f5:e3:27:ce:99:97:e9";
|
||||
|
||||
private final static String rin2 = "1b:49:a6:7a:83:1c:b6:28:47:16:2f:be:6a:d3:28:a6:83:07:4f:50:be:5c:99:26:2a:15:b8:21:a8:cc:8a:45:93:07:ff:32:67:3c:a4:92:d2:cd:43:eb:f5:2e:09:79:c8:32:3a:9d:00:4c:f5:6e:65:b2:ca:9c:c2:d5:35:8e:fe:6c:ba:1a:7b:65:c1:4f:e9:6c:cb:5d:9f:13:5d:5f:be:32:cd:91:ed:8b:d7:d7:e9:d6:5c:cc:11:7b:d9:ff:7a:93:de:e4:81:92:56:0c:52:47:75:56:a8:e0:9a:55:16:0c:43:df:ae:be:a1:6a:9d:5a:be:fc:51:ea:52:0c";
|
||||
private final static String rout2 = "65:28:b9:48:8d:68:3f:5e:9a:85:e7:09:78:4c:0c:0e:60:6c:89:43:3c:d3:72:b9:2f:5a:eb:4f:15:77:93:9d:47:05:a6:52:48:72:ee:ce:e8:5a:6d:28:b0:06:5a:a1:93:58:a1:61:3f:9b:42:0d:c1:ec:32:0a:7a:1e:38:45:47:87:52:16:62:c9:44:c6:04:4d:82:64:01:f4:b1:26:dc:7f:61:82:52:7a:f6:6b:ab:22:98:87:93:63:4c:3f:92:c7:5b:cc:e5:2b:15:db:f7:d3:c7:b5:38:6f:15:3b:1e:88:3d:31:0c:b4:f9:6d:66:41:b7:1b:a0:4a:b8:16";
|
||||
private final static String rin2 = "1b:49:a6:7a:83:1c:b6:28:47:16:2f:be:6a:d3:28:a6:83:07:4f:50:be:5c:99:26:2a:15:b8:21:a8:cc:8a:45:93:07:ff:32:67:3c:a4:92:d2:cd:43:eb:f5:2e:09:79:c8:32:3a:9d:00:4c:f5:6e:65:b2:ca:9c:c2:d5:35:8e:fe:6c:ba:1a:7b:65:c1:4f:e9:6c:cb:5d:9f:13:5d:5f:be:32:cd:91:ed:8b:d7:d7:e9:d6:5c:cc:11:7b:d9:ff:7a:93:de:e4:81:92:56:0c:52:47:75:56:a8:e0:9a:55:16:0c:43:df:ae:be:a1:6a:9d:5a:be:fc:51:ea:52:0c:1b:49:a6:7a:83:1c:b6:28:47:16:2f:be:6a:d3:28:a6:83:07:4f:50:be:5c:99:26:2a:15:b8:21:a8:cc:8a:45:93:07:ff:32:67:3c:a4:92:d2:cd:43:eb:f5:2e:09:79:c8:32:3a:9d:00:4c:f5:6e:65:b2:ca:9c:c2:d5:35:8e:fe:6c:ba:1a:7b:65:c1:4f:e9:6c:cb:5d:9f:13:5d:5f:be:32:cd:91:ed:8b:d7:d7:e9:d6:5c:cc:11:7b:d9:ff:7a:93:de:e4:81:92:56:0c:52:47:75:56:a8:e0:9a:55:16:0c:43:df:ae:be:a1:6a:9d:5a:be:fc:51:ea:52:0c";
|
||||
private final static String rout2 = "7a:11:19:cf:76:97:4b:29:48:66:69:e7:f0:db:18:53:d4:50:71:a4:9d:90:47:9f:e6:8a:f3:ba:2e:96:fd:c8:4b:02:7e:06:a9:2b:47:0d:68:3c:6a:f9:21:62:77:0d:4e:e1:1b:82:97:66:13:01:c2:3b:b2:d3:f8:9e:cc:c9:2a:1a:76:05:3f:d4:f7:fb:9d:9b:bf:a8:2d:fd:81:e5:f4:bb:ca:3b:5f:93:ea:ef:88:1c:c1:18:52:38:be:50:42:29:08:d9:65:43:5f:01:7d:50:22:7a:2f:f1:29:14:95:30:c1:b8:fd:eb:da:c1:4e:8a:ef:97:84:f9:cf:34:ab:89:a6:3c:4a:ff:a4:98:a8:7c:c6:2c:c3:e3:10:a9:8b:67:32:47:35:37:15:03:3b:d0:f3:23:fc:bb:42:64:a2:ba:63:3e:94:6e:7a:e6:94:05:79:29:28:d5:99:5b:f9:67:fd:ea:d3:5f:b5:7b:f4:10:9b:0a:1c:20:6b:0c:59:56:76:45:07:56:cb:d0:ab:08:fc:19:8e:f1:27:03:22:f1:e9:23:d3:01:b1:4d:cf:96:f7:a6:44:59:de:2a:52:fd:bb:14:ae:39:c4:e4:0f:4e:10:f7:c6:61:79:0a:a6:4c:ed:ee:d7:40:fe:ef:f3:85:ae:3e:f3:bb:6e:de";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
long start = System.currentTimeMillis();
|
||||
@@ -190,8 +198,8 @@ public class TestRSA {
|
||||
// blocktype 1
|
||||
testEncDec("RSA/ECB/PKCS1Padding", 96, privateKey, publicKey);
|
||||
|
||||
testEncDec("RSA/ECB/NoPadding", 128, publicKey, privateKey);
|
||||
testEncDec("RSA/ECB/NoPadding", 128, privateKey, publicKey);
|
||||
testEncDec("RSA/ECB/NoPadding", 256, publicKey, privateKey);
|
||||
testEncDec("RSA/ECB/NoPadding", 256, privateKey, publicKey);
|
||||
|
||||
// expected failure, blocktype 2 random padding bytes are different
|
||||
testKat("RSA/ECB/PKCS1Padding", Cipher.ENCRYPT_MODE, publicKey, in2, out2, false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -24,6 +24,7 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 0000000
|
||||
* @library /test/lib
|
||||
* @summary DHGenSharedSecret
|
||||
* @author Jan Luehe
|
||||
*/
|
||||
@@ -33,40 +34,11 @@ import java.security.interfaces.*;
|
||||
import javax.crypto.*;
|
||||
import javax.crypto.spec.*;
|
||||
import java.math.BigInteger;
|
||||
import jdk.test.lib.security.DiffieHellmanGroup;
|
||||
import jdk.test.lib.security.SecurityUtils;
|
||||
|
||||
public class DHGenSharedSecret {
|
||||
|
||||
static byte[] DHPrime = {
|
||||
(byte)0x00, (byte)0x8D, (byte)0x8A, (byte)0x6C, (byte)0x7F, (byte)0xCC,
|
||||
(byte)0xA5, (byte)0xBF, (byte)0x9C, (byte)0xE1, (byte)0xFA, (byte)0x3C,
|
||||
(byte)0xCA, (byte)0x98, (byte)0xB7, (byte)0x99, (byte)0xD1, (byte)0xE5,
|
||||
(byte)0x2C, (byte)0xC0, (byte)0x26, (byte)0x97, (byte)0x12, (byte)0x80,
|
||||
(byte)0x12, (byte)0xEF, (byte)0x0B, (byte)0xDE, (byte)0x71, (byte)0x76,
|
||||
(byte)0xAA, (byte)0x2D, (byte)0x86, (byte)0x41, (byte)0x0E, (byte)0x6A,
|
||||
(byte)0xC2, (byte)0x12, (byte)0xAA, (byte)0xAA, (byte)0xE4, (byte)0x84,
|
||||
(byte)0x80, (byte)0x13, (byte)0x95, (byte)0x06, (byte)0xC4, (byte)0x83,
|
||||
(byte)0xB9, (byte)0xD3, (byte)0x72, (byte)0xC5, (byte)0xC8, (byte)0x85,
|
||||
(byte)0x96, (byte)0x59, (byte)0x08, (byte)0xFA, (byte)0x9E, (byte)0x3C,
|
||||
(byte)0xDC, (byte)0x92, (byte)0x28, (byte)0xC3, (byte)0x1D, (byte)0x6F,
|
||||
(byte)0x44, (byte)0x36, (byte)0x70, (byte)0x40, (byte)0x80, (byte)0xF1,
|
||||
(byte)0x35
|
||||
};
|
||||
|
||||
static byte[] DHBase = {
|
||||
(byte)0x72, (byte)0x21, (byte)0xB3, (byte)0xA8, (byte)0x83, (byte)0xDD,
|
||||
(byte)0x76, (byte)0xF5, (byte)0x0D, (byte)0x9B, (byte)0x81, (byte)0x11,
|
||||
(byte)0x15, (byte)0x03, (byte)0x6D, (byte)0x4D, (byte)0x46, (byte)0x65,
|
||||
(byte)0x30, (byte)0xB0, (byte)0xFA, (byte)0xFE, (byte)0xBE, (byte)0xA8,
|
||||
(byte)0xD9, (byte)0x83, (byte)0x33, (byte)0x54, (byte)0xC7, (byte)0xF6,
|
||||
(byte)0x81, (byte)0xAC, (byte)0xCC, (byte)0xA3, (byte)0xAE, (byte)0xAA,
|
||||
(byte)0xC8, (byte)0x11, (byte)0x38, (byte)0xD4, (byte)0x4F, (byte)0xC4,
|
||||
(byte)0x89, (byte)0xD3, (byte)0x72, (byte)0xEE, (byte)0x22, (byte)0x5A,
|
||||
(byte)0x68, (byte)0xF7, (byte)0xAC, (byte)0x24, (byte)0x01, (byte)0x9B,
|
||||
(byte)0xE9, (byte)0x08, (byte)0xFE, (byte)0x58, (byte)0x0A, (byte)0xCF,
|
||||
(byte)0xB9, (byte)0x52, (byte)0xB4, (byte)0x02, (byte)0x73, (byte)0xA4,
|
||||
(byte)0xA6, (byte)0xB9, (byte)0x0C, (byte)0x8D, (byte)0xA7, (byte)0xFB,
|
||||
};
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
DHGenSharedSecret test = new DHGenSharedSecret();
|
||||
test.run();
|
||||
@@ -75,8 +47,9 @@ public class DHGenSharedSecret {
|
||||
public void run() throws Exception {
|
||||
long start, end;
|
||||
|
||||
BigInteger p = new BigInteger(1, DHPrime);
|
||||
BigInteger g = new BigInteger(1, DHBase);
|
||||
DiffieHellmanGroup dhGroup = SecurityUtils.getTestDHGroup();
|
||||
BigInteger p = dhGroup.getPrime();
|
||||
BigInteger g = new BigInteger(1, dhGroup.getBase().toByteArray());
|
||||
int l = 512;
|
||||
|
||||
DHParameterSpec spec =
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -24,6 +24,7 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 7146728
|
||||
* @library /test/lib
|
||||
* @summary DHKeyAgreement2
|
||||
* @author Jan Luehe
|
||||
* @run main/othervm -Djdk.crypto.KeyAgreement.legacyKDF=true DHKeyAgreement2
|
||||
@@ -38,13 +39,14 @@ import java.util.HexFormat;
|
||||
import javax.crypto.*;
|
||||
import javax.crypto.spec.*;
|
||||
import javax.crypto.interfaces.*;
|
||||
import jdk.test.lib.security.DiffieHellmanGroup;
|
||||
import jdk.test.lib.security.SecurityUtils;
|
||||
|
||||
/**
|
||||
* This test utility executes the Diffie-Hellman key agreement protocol
|
||||
* between 2 parties: Alice and Bob.
|
||||
*
|
||||
* By default, preconfigured parameters (1024 bit prime modulus and base
|
||||
* generator used by SKIP) are used.
|
||||
* By default, preconfigured parameters are used.
|
||||
* If this program is called with the "-gen" option, a new set of parameters
|
||||
* are created.
|
||||
*/
|
||||
@@ -59,7 +61,7 @@ public class DHKeyAgreement2 {
|
||||
private DHKeyAgreement2() {}
|
||||
|
||||
public static void main(String argv[]) throws Exception {
|
||||
String mode = "USE_SKIP_DH_PARAMS";
|
||||
String mode = "USE_PRECONFIGURED_DH_PARAMS";
|
||||
|
||||
DHKeyAgreement2 keyAgree = new DHKeyAgreement2();
|
||||
|
||||
@@ -80,22 +82,25 @@ public class DHKeyAgreement2 {
|
||||
|
||||
private void run(String mode) throws Exception {
|
||||
|
||||
DHParameterSpec dhSkipParamSpec;
|
||||
DHParameterSpec dhParameterSpec;
|
||||
String algorithm = "DH";
|
||||
int primeSize = SecurityUtils.getTestKeySize(algorithm);
|
||||
|
||||
if (mode.equals("GENERATE_DH_PARAMS")) {
|
||||
// Some central authority creates new DH parameters
|
||||
System.err.println("Creating Diffie-Hellman parameters ...");
|
||||
AlgorithmParameterGenerator paramGen
|
||||
= AlgorithmParameterGenerator.getInstance("DH", SUNJCE);
|
||||
paramGen.init(512);
|
||||
paramGen.init(primeSize);
|
||||
AlgorithmParameters params = paramGen.generateParameters();
|
||||
dhSkipParamSpec = (DHParameterSpec)params.getParameterSpec
|
||||
dhParameterSpec = (DHParameterSpec)params.getParameterSpec
|
||||
(DHParameterSpec.class);
|
||||
} else {
|
||||
// use some pre-generated, default DH parameters
|
||||
System.err.println("Using SKIP Diffie-Hellman parameters");
|
||||
dhSkipParamSpec = new DHParameterSpec(skip1024Modulus,
|
||||
skip1024Base);
|
||||
// use some pre-generated, test default DH parameters
|
||||
DiffieHellmanGroup dhGroup = SecurityUtils.getTestDHGroup(primeSize);
|
||||
System.err.println("Using " + dhGroup.name() + " Diffie-Hellman parameters");
|
||||
dhParameterSpec = new DHParameterSpec(dhGroup.getPrime(),
|
||||
dhGroup.getBase());
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -104,7 +109,7 @@ public class DHKeyAgreement2 {
|
||||
*/
|
||||
System.err.println("ALICE: Generate DH keypair ...");
|
||||
KeyPairGenerator aliceKpairGen = KeyPairGenerator.getInstance("DH", SUNJCE);
|
||||
aliceKpairGen.initialize(dhSkipParamSpec);
|
||||
aliceKpairGen.initialize(dhParameterSpec);
|
||||
KeyPair aliceKpair = aliceKpairGen.generateKeyPair();
|
||||
System.out.println("Alice DH public key:\n" +
|
||||
aliceKpair.getPublic().toString());
|
||||
@@ -274,47 +279,4 @@ public class DHKeyAgreement2 {
|
||||
System.err.print("DHKeyAgreement usage: ");
|
||||
System.err.println("[-gen]");
|
||||
}
|
||||
|
||||
// The 1024 bit Diffie-Hellman modulus values used by SKIP
|
||||
private static final byte skip1024ModulusBytes[] = {
|
||||
(byte)0xF4, (byte)0x88, (byte)0xFD, (byte)0x58,
|
||||
(byte)0x4E, (byte)0x49, (byte)0xDB, (byte)0xCD,
|
||||
(byte)0x20, (byte)0xB4, (byte)0x9D, (byte)0xE4,
|
||||
(byte)0x91, (byte)0x07, (byte)0x36, (byte)0x6B,
|
||||
(byte)0x33, (byte)0x6C, (byte)0x38, (byte)0x0D,
|
||||
(byte)0x45, (byte)0x1D, (byte)0x0F, (byte)0x7C,
|
||||
(byte)0x88, (byte)0xB3, (byte)0x1C, (byte)0x7C,
|
||||
(byte)0x5B, (byte)0x2D, (byte)0x8E, (byte)0xF6,
|
||||
(byte)0xF3, (byte)0xC9, (byte)0x23, (byte)0xC0,
|
||||
(byte)0x43, (byte)0xF0, (byte)0xA5, (byte)0x5B,
|
||||
(byte)0x18, (byte)0x8D, (byte)0x8E, (byte)0xBB,
|
||||
(byte)0x55, (byte)0x8C, (byte)0xB8, (byte)0x5D,
|
||||
(byte)0x38, (byte)0xD3, (byte)0x34, (byte)0xFD,
|
||||
(byte)0x7C, (byte)0x17, (byte)0x57, (byte)0x43,
|
||||
(byte)0xA3, (byte)0x1D, (byte)0x18, (byte)0x6C,
|
||||
(byte)0xDE, (byte)0x33, (byte)0x21, (byte)0x2C,
|
||||
(byte)0xB5, (byte)0x2A, (byte)0xFF, (byte)0x3C,
|
||||
(byte)0xE1, (byte)0xB1, (byte)0x29, (byte)0x40,
|
||||
(byte)0x18, (byte)0x11, (byte)0x8D, (byte)0x7C,
|
||||
(byte)0x84, (byte)0xA7, (byte)0x0A, (byte)0x72,
|
||||
(byte)0xD6, (byte)0x86, (byte)0xC4, (byte)0x03,
|
||||
(byte)0x19, (byte)0xC8, (byte)0x07, (byte)0x29,
|
||||
(byte)0x7A, (byte)0xCA, (byte)0x95, (byte)0x0C,
|
||||
(byte)0xD9, (byte)0x96, (byte)0x9F, (byte)0xAB,
|
||||
(byte)0xD0, (byte)0x0A, (byte)0x50, (byte)0x9B,
|
||||
(byte)0x02, (byte)0x46, (byte)0xD3, (byte)0x08,
|
||||
(byte)0x3D, (byte)0x66, (byte)0xA4, (byte)0x5D,
|
||||
(byte)0x41, (byte)0x9F, (byte)0x9C, (byte)0x7C,
|
||||
(byte)0xBD, (byte)0x89, (byte)0x4B, (byte)0x22,
|
||||
(byte)0x19, (byte)0x26, (byte)0xBA, (byte)0xAB,
|
||||
(byte)0xA2, (byte)0x5E, (byte)0xC3, (byte)0x55,
|
||||
(byte)0xE9, (byte)0x2F, (byte)0x78, (byte)0xC7
|
||||
};
|
||||
|
||||
// The SKIP 1024 bit modulus
|
||||
private static final BigInteger skip1024Modulus
|
||||
= new BigInteger(1, skip1024ModulusBytes);
|
||||
|
||||
// The base used with the SKIP 1024 bit modulus
|
||||
private static final BigInteger skip1024Base = BigInteger.valueOf(2);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -24,6 +24,7 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 0000000
|
||||
* @library /test/lib
|
||||
* @summary DHKeyAgreement3
|
||||
* @author Jan Luehe
|
||||
*/
|
||||
@@ -37,13 +38,14 @@ import java.util.HexFormat;
|
||||
import javax.crypto.*;
|
||||
import javax.crypto.spec.*;
|
||||
import javax.crypto.interfaces.*;
|
||||
import jdk.test.lib.security.DiffieHellmanGroup;
|
||||
import jdk.test.lib.security.SecurityUtils;
|
||||
|
||||
/**
|
||||
* This test utility executes the Diffie-Hellman key agreement protocol
|
||||
* between 3 parties: Alice, Bob, and Carol.
|
||||
*
|
||||
* We use the same 1024 bit prime modulus and base generator that are used by
|
||||
* SKIP.
|
||||
* By default, preconfigured parameters are used.
|
||||
*/
|
||||
|
||||
public class DHKeyAgreement3 {
|
||||
@@ -61,27 +63,27 @@ public class DHKeyAgreement3 {
|
||||
|
||||
private void run() throws Exception {
|
||||
|
||||
DHParameterSpec dhSkipParamSpec;
|
||||
|
||||
System.err.println("Using SKIP Diffie-Hellman parameters");
|
||||
dhSkipParamSpec = new DHParameterSpec(skip1024Modulus, skip1024Base);
|
||||
DiffieHellmanGroup dhGroup = SecurityUtils.getTestDHGroup();
|
||||
DHParameterSpec dhParamSpec;
|
||||
System.err.println("Using " + dhGroup.name() + " Diffie-Hellman parameters");
|
||||
dhParamSpec = new DHParameterSpec(dhGroup.getPrime(), dhGroup.getBase());
|
||||
|
||||
// Alice creates her own DH key pair
|
||||
System.err.println("ALICE: Generate DH keypair ...");
|
||||
KeyPairGenerator aliceKpairGen = KeyPairGenerator.getInstance("DH", "SunJCE");
|
||||
aliceKpairGen.initialize(dhSkipParamSpec);
|
||||
aliceKpairGen.initialize(dhParamSpec);
|
||||
KeyPair aliceKpair = aliceKpairGen.generateKeyPair();
|
||||
|
||||
// Bob creates his own DH key pair
|
||||
System.err.println("BOB: Generate DH keypair ...");
|
||||
KeyPairGenerator bobKpairGen = KeyPairGenerator.getInstance("DH", "SunJCE");
|
||||
bobKpairGen.initialize(dhSkipParamSpec);
|
||||
bobKpairGen.initialize(dhParamSpec);
|
||||
KeyPair bobKpair = bobKpairGen.generateKeyPair();
|
||||
|
||||
// Carol creates her own DH key pair
|
||||
System.err.println("CAROL: Generate DH keypair ...");
|
||||
KeyPairGenerator carolKpairGen = KeyPairGenerator.getInstance("DH", "SunJCE");
|
||||
carolKpairGen.initialize(dhSkipParamSpec);
|
||||
carolKpairGen.initialize(dhParamSpec);
|
||||
KeyPair carolKpair = carolKpairGen.generateKeyPair();
|
||||
|
||||
|
||||
@@ -178,47 +180,4 @@ public class DHKeyAgreement3 {
|
||||
System.err.print("DHKeyAgreement usage: ");
|
||||
System.err.println("[-gen]");
|
||||
}
|
||||
|
||||
// The 1024 bit Diffie-Hellman modulus values used by SKIP
|
||||
private static final byte skip1024ModulusBytes[] = {
|
||||
(byte)0xF4, (byte)0x88, (byte)0xFD, (byte)0x58,
|
||||
(byte)0x4E, (byte)0x49, (byte)0xDB, (byte)0xCD,
|
||||
(byte)0x20, (byte)0xB4, (byte)0x9D, (byte)0xE4,
|
||||
(byte)0x91, (byte)0x07, (byte)0x36, (byte)0x6B,
|
||||
(byte)0x33, (byte)0x6C, (byte)0x38, (byte)0x0D,
|
||||
(byte)0x45, (byte)0x1D, (byte)0x0F, (byte)0x7C,
|
||||
(byte)0x88, (byte)0xB3, (byte)0x1C, (byte)0x7C,
|
||||
(byte)0x5B, (byte)0x2D, (byte)0x8E, (byte)0xF6,
|
||||
(byte)0xF3, (byte)0xC9, (byte)0x23, (byte)0xC0,
|
||||
(byte)0x43, (byte)0xF0, (byte)0xA5, (byte)0x5B,
|
||||
(byte)0x18, (byte)0x8D, (byte)0x8E, (byte)0xBB,
|
||||
(byte)0x55, (byte)0x8C, (byte)0xB8, (byte)0x5D,
|
||||
(byte)0x38, (byte)0xD3, (byte)0x34, (byte)0xFD,
|
||||
(byte)0x7C, (byte)0x17, (byte)0x57, (byte)0x43,
|
||||
(byte)0xA3, (byte)0x1D, (byte)0x18, (byte)0x6C,
|
||||
(byte)0xDE, (byte)0x33, (byte)0x21, (byte)0x2C,
|
||||
(byte)0xB5, (byte)0x2A, (byte)0xFF, (byte)0x3C,
|
||||
(byte)0xE1, (byte)0xB1, (byte)0x29, (byte)0x40,
|
||||
(byte)0x18, (byte)0x11, (byte)0x8D, (byte)0x7C,
|
||||
(byte)0x84, (byte)0xA7, (byte)0x0A, (byte)0x72,
|
||||
(byte)0xD6, (byte)0x86, (byte)0xC4, (byte)0x03,
|
||||
(byte)0x19, (byte)0xC8, (byte)0x07, (byte)0x29,
|
||||
(byte)0x7A, (byte)0xCA, (byte)0x95, (byte)0x0C,
|
||||
(byte)0xD9, (byte)0x96, (byte)0x9F, (byte)0xAB,
|
||||
(byte)0xD0, (byte)0x0A, (byte)0x50, (byte)0x9B,
|
||||
(byte)0x02, (byte)0x46, (byte)0xD3, (byte)0x08,
|
||||
(byte)0x3D, (byte)0x66, (byte)0xA4, (byte)0x5D,
|
||||
(byte)0x41, (byte)0x9F, (byte)0x9C, (byte)0x7C,
|
||||
(byte)0xBD, (byte)0x89, (byte)0x4B, (byte)0x22,
|
||||
(byte)0x19, (byte)0x26, (byte)0xBA, (byte)0xAB,
|
||||
(byte)0xA2, (byte)0x5E, (byte)0xC3, (byte)0x55,
|
||||
(byte)0xE9, (byte)0x2F, (byte)0x78, (byte)0xC7
|
||||
};
|
||||
|
||||
// The SKIP 1024 bit modulus
|
||||
private static final BigInteger skip1024Modulus
|
||||
= new BigInteger(1, skip1024ModulusBytes);
|
||||
|
||||
// The base used with the SKIP 1024 bit modulus
|
||||
private static final BigInteger skip1024Base = BigInteger.valueOf(2);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 0000000
|
||||
* @library /test/lib
|
||||
* @summary DHKeyFactory
|
||||
* @author Jan Luehe
|
||||
*/
|
||||
@@ -36,6 +37,8 @@ import java.security.interfaces.*;
|
||||
import javax.crypto.*;
|
||||
import javax.crypto.spec.*;
|
||||
import javax.crypto.interfaces.*;
|
||||
import jdk.test.lib.security.DiffieHellmanGroup;
|
||||
import jdk.test.lib.security.SecurityUtils;
|
||||
|
||||
/**
|
||||
* This test creates a DH keypair, retrieves the encodings of the DH public and
|
||||
@@ -55,16 +58,13 @@ public class DHKeyFactory {
|
||||
|
||||
private void run() throws Exception {
|
||||
|
||||
DHParameterSpec dhSkipParamSpec;
|
||||
|
||||
// use some pre-generated, default DH parameters
|
||||
System.err.println("Using SKIP Diffie-Hellman parameters");
|
||||
dhSkipParamSpec = new DHParameterSpec(skip1024Modulus,
|
||||
skip1024Base);
|
||||
DiffieHellmanGroup dhGroup = SecurityUtils.getTestDHGroup();
|
||||
DHParameterSpec dhParamSpec = new DHParameterSpec(dhGroup.getPrime(), dhGroup.getBase());
|
||||
System.out.println("Using " + dhGroup.name() + " Diffie-Hellman parameters");
|
||||
|
||||
KeyPairGenerator kpgen = KeyPairGenerator.getInstance("DH",
|
||||
System.getProperty("test.provider.name", "SunJCE"));
|
||||
kpgen.initialize(dhSkipParamSpec);
|
||||
kpgen.initialize(dhParamSpec);
|
||||
KeyPair kp = kpgen.generateKeyPair();
|
||||
|
||||
// get the public key encoding
|
||||
@@ -82,47 +82,4 @@ public class DHKeyFactory {
|
||||
PKCS8EncodedKeySpec pkcsKeySpec = new PKCS8EncodedKeySpec(privKeyEnc);
|
||||
PrivateKey privKey = kfac.generatePrivate(pkcsKeySpec);
|
||||
}
|
||||
|
||||
// The 1024 bit Diffie-Hellman modulus values used by SKIP
|
||||
private static final byte skip1024ModulusBytes[] = {
|
||||
(byte)0xF4, (byte)0x88, (byte)0xFD, (byte)0x58,
|
||||
(byte)0x4E, (byte)0x49, (byte)0xDB, (byte)0xCD,
|
||||
(byte)0x20, (byte)0xB4, (byte)0x9D, (byte)0xE4,
|
||||
(byte)0x91, (byte)0x07, (byte)0x36, (byte)0x6B,
|
||||
(byte)0x33, (byte)0x6C, (byte)0x38, (byte)0x0D,
|
||||
(byte)0x45, (byte)0x1D, (byte)0x0F, (byte)0x7C,
|
||||
(byte)0x88, (byte)0xB3, (byte)0x1C, (byte)0x7C,
|
||||
(byte)0x5B, (byte)0x2D, (byte)0x8E, (byte)0xF6,
|
||||
(byte)0xF3, (byte)0xC9, (byte)0x23, (byte)0xC0,
|
||||
(byte)0x43, (byte)0xF0, (byte)0xA5, (byte)0x5B,
|
||||
(byte)0x18, (byte)0x8D, (byte)0x8E, (byte)0xBB,
|
||||
(byte)0x55, (byte)0x8C, (byte)0xB8, (byte)0x5D,
|
||||
(byte)0x38, (byte)0xD3, (byte)0x34, (byte)0xFD,
|
||||
(byte)0x7C, (byte)0x17, (byte)0x57, (byte)0x43,
|
||||
(byte)0xA3, (byte)0x1D, (byte)0x18, (byte)0x6C,
|
||||
(byte)0xDE, (byte)0x33, (byte)0x21, (byte)0x2C,
|
||||
(byte)0xB5, (byte)0x2A, (byte)0xFF, (byte)0x3C,
|
||||
(byte)0xE1, (byte)0xB1, (byte)0x29, (byte)0x40,
|
||||
(byte)0x18, (byte)0x11, (byte)0x8D, (byte)0x7C,
|
||||
(byte)0x84, (byte)0xA7, (byte)0x0A, (byte)0x72,
|
||||
(byte)0xD6, (byte)0x86, (byte)0xC4, (byte)0x03,
|
||||
(byte)0x19, (byte)0xC8, (byte)0x07, (byte)0x29,
|
||||
(byte)0x7A, (byte)0xCA, (byte)0x95, (byte)0x0C,
|
||||
(byte)0xD9, (byte)0x96, (byte)0x9F, (byte)0xAB,
|
||||
(byte)0xD0, (byte)0x0A, (byte)0x50, (byte)0x9B,
|
||||
(byte)0x02, (byte)0x46, (byte)0xD3, (byte)0x08,
|
||||
(byte)0x3D, (byte)0x66, (byte)0xA4, (byte)0x5D,
|
||||
(byte)0x41, (byte)0x9F, (byte)0x9C, (byte)0x7C,
|
||||
(byte)0xBD, (byte)0x89, (byte)0x4B, (byte)0x22,
|
||||
(byte)0x19, (byte)0x26, (byte)0xBA, (byte)0xAB,
|
||||
(byte)0xA2, (byte)0x5E, (byte)0xC3, (byte)0x55,
|
||||
(byte)0xE9, (byte)0x2F, (byte)0x78, (byte)0xC7
|
||||
};
|
||||
|
||||
// The SKIP 1024 bit modulus
|
||||
private static final BigInteger skip1024Modulus
|
||||
= new BigInteger(1, skip1024ModulusBytes);
|
||||
|
||||
// The base used with the SKIP 1024 bit modulus
|
||||
private static final BigInteger skip1024Base = BigInteger.valueOf(2);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 0000000
|
||||
* @library /test/lib
|
||||
* @summary DHKeyGenSpeed
|
||||
* @author Jan Luehe
|
||||
*/
|
||||
@@ -33,42 +34,11 @@ import java.security.interfaces.*;
|
||||
import javax.crypto.*;
|
||||
import javax.crypto.spec.*;
|
||||
import java.math.*;
|
||||
import jdk.test.lib.security.DiffieHellmanGroup;
|
||||
import jdk.test.lib.security.SecurityUtils;
|
||||
|
||||
public class DHKeyGenSpeed {
|
||||
|
||||
static byte[] DHPrime = {
|
||||
(byte)0x00, (byte)0x91, (byte)0x18, (byte)0x26, (byte)0x9A, (byte)0x26,
|
||||
(byte)0x43, (byte)0xA6, (byte)0x1E, (byte)0x11, (byte)0x02, (byte)0xA0,
|
||||
(byte)0x88, (byte)0xFE, (byte)0x12, (byte)0xEA, (byte)0x63, (byte)0x20,
|
||||
(byte)0x6D, (byte)0x4F, (byte)0x40, (byte)0x3C, (byte)0x4F, (byte)0x13,
|
||||
(byte)0x10, (byte)0x97, (byte)0xEC, (byte)0x3A, (byte)0x38, (byte)0x87,
|
||||
(byte)0x9B, (byte)0x08, (byte)0x66, (byte)0x0C, (byte)0x82, (byte)0xD0,
|
||||
(byte)0x57, (byte)0xE0, (byte)0x37, (byte)0x16, (byte)0x8E, (byte)0xB4,
|
||||
(byte)0xEA, (byte)0xB7, (byte)0xE6, (byte)0xAF, (byte)0x4C, (byte)0xE0,
|
||||
(byte)0x40, (byte)0x07, (byte)0xF4, (byte)0x81, (byte)0xDD, (byte)0x36,
|
||||
(byte)0x33, (byte)0xAD, (byte)0x92, (byte)0xC6, (byte)0x0F, (byte)0xB5,
|
||||
(byte)0xE4, (byte)0x0F, (byte)0x0E, (byte)0xEA, (byte)0x91, (byte)0x35,
|
||||
(byte)0xFB, (byte)0x55, (byte)0x7A, (byte)0x39, (byte)0xD1, (byte)0xF0,
|
||||
(byte)0x6B, (byte)0x9A, (byte)0xB9, (byte)0xFA, (byte)0x19, (byte)0xBE,
|
||||
(byte)0x1B, (byte)0xFD, (byte)0x77
|
||||
};
|
||||
static byte[] DHBase = {
|
||||
(byte)0x29, (byte)0xF2, (byte)0x29, (byte)0xC8, (byte)0x42, (byte)0x25,
|
||||
(byte)0x29, (byte)0xC3, (byte)0xF2, (byte)0xAA, (byte)0xF2, (byte)0x6A,
|
||||
(byte)0x3C, (byte)0xD2, (byte)0xD2, (byte)0xDE, (byte)0xD3, (byte)0x6B,
|
||||
(byte)0x85, (byte)0xA5, (byte)0xE1, (byte)0x43, (byte)0x90, (byte)0xA2,
|
||||
(byte)0xB6, (byte)0xA5, (byte)0x0C, (byte)0xBA, (byte)0xB9, (byte)0x4C,
|
||||
(byte)0x25, (byte)0xE0, (byte)0xC8, (byte)0xEA, (byte)0xA1, (byte)0x7B,
|
||||
(byte)0xB9, (byte)0xF8, (byte)0xFF, (byte)0x15, (byte)0x66, (byte)0x5B,
|
||||
(byte)0xB0, (byte)0x00, (byte)0x18, (byte)0xE2, (byte)0xF4, (byte)0xF1,
|
||||
(byte)0xB4, (byte)0x7A, (byte)0xC2, (byte)0xCF, (byte)0x9C, (byte)0x61,
|
||||
(byte)0x36, (byte)0xED, (byte)0x14, (byte)0x72, (byte)0xD7, (byte)0xD4,
|
||||
(byte)0x94, (byte)0x20, (byte)0x5E, (byte)0x1E, (byte)0xE4, (byte)0xB1,
|
||||
(byte)0x60, (byte)0xC8, (byte)0x10, (byte)0x85, (byte)0xBD, (byte)0x74,
|
||||
(byte)0x34, (byte)0x8C, (byte)0x3C, (byte)0x2A, (byte)0xBD, (byte)0x3C,
|
||||
(byte)0xFF, (byte)0x14
|
||||
};
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
DHKeyGenSpeed test = new DHKeyGenSpeed();
|
||||
test.run();
|
||||
@@ -78,8 +48,9 @@ public class DHKeyGenSpeed {
|
||||
public void run() throws Exception {
|
||||
long start, end;
|
||||
|
||||
BigInteger p = new BigInteger(1, DHPrime);
|
||||
BigInteger g = new BigInteger(1, DHBase);
|
||||
DiffieHellmanGroup dhGroup = SecurityUtils.getTestDHGroup();
|
||||
BigInteger p = dhGroup.getPrime();
|
||||
BigInteger g = new BigInteger(1, dhGroup.getBase().toByteArray());
|
||||
int l = 576;
|
||||
|
||||
DHParameterSpec spec =
|
||||
@@ -95,7 +66,7 @@ public class DHKeyGenSpeed {
|
||||
end = System.currentTimeMillis();
|
||||
|
||||
System.out.println("PrimeBits\tExponentBits");
|
||||
System.out.println(DHPrime.length*8 + "\t\t" + l);
|
||||
System.out.println(dhGroup.getPrime().bitLength() + "\t\t" + l);
|
||||
System.out.println("keyGen(millisecond): " + (end - start));
|
||||
System.out.println("Test Passed!");
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class TestLeadingZeroes {
|
||||
System.out.println("shared secret:\n" + HEX_FORMATTER.formatHex(sharedSecret));
|
||||
|
||||
// verify that leading zero is present
|
||||
if (sharedSecret.length != 128) {
|
||||
if (sharedSecret.length != 256) {
|
||||
throw new Exception("Unexpected shared secret length");
|
||||
}
|
||||
if (sharedSecret[0] != 0) {
|
||||
@@ -97,7 +97,7 @@ public class TestLeadingZeroes {
|
||||
"tls premaster secret:\n" + HEX_FORMATTER.formatHex(tlsPremasterSecret));
|
||||
|
||||
// check that leading zero has been stripped
|
||||
if (tlsPremasterSecret.length != 127) {
|
||||
if (tlsPremasterSecret.length != 255) {
|
||||
throw new Exception("Unexpected TLS premaster secret length");
|
||||
}
|
||||
if (tlsPremasterSecret[0] == 0) {
|
||||
@@ -112,279 +112,455 @@ public class TestLeadingZeroes {
|
||||
}
|
||||
|
||||
private static final byte alicePubKeyEnc[] = {
|
||||
(byte)0x30, (byte)0x82, (byte)0x01, (byte)0x24,
|
||||
(byte)0x30, (byte)0x81, (byte)0x99, (byte)0x06,
|
||||
(byte)0x09, (byte)0x2A, (byte)0x86, (byte)0x48,
|
||||
(byte)0x86, (byte)0xF7, (byte)0x0D, (byte)0x01,
|
||||
(byte)0x03, (byte)0x01, (byte)0x30, (byte)0x81,
|
||||
(byte)0x8B, (byte)0x02, (byte)0x81, (byte)0x81,
|
||||
(byte)0x00, (byte)0xF4, (byte)0x88, (byte)0xFD,
|
||||
(byte)0x58, (byte)0x4E, (byte)0x49, (byte)0xDB,
|
||||
(byte)0xCD, (byte)0x20, (byte)0xB4, (byte)0x9D,
|
||||
(byte)0xE4, (byte)0x91, (byte)0x07, (byte)0x36,
|
||||
(byte)0x6B, (byte)0x33, (byte)0x6C, (byte)0x38,
|
||||
(byte)0x0D, (byte)0x45, (byte)0x1D, (byte)0x0F,
|
||||
(byte)0x7C, (byte)0x88, (byte)0xB3, (byte)0x1C,
|
||||
(byte)0x7C, (byte)0x5B, (byte)0x2D, (byte)0x8E,
|
||||
(byte)0xF6, (byte)0xF3, (byte)0xC9, (byte)0x23,
|
||||
(byte)0xC0, (byte)0x43, (byte)0xF0, (byte)0xA5,
|
||||
(byte)0x5B, (byte)0x18, (byte)0x8D, (byte)0x8E,
|
||||
(byte)0xBB, (byte)0x55, (byte)0x8C, (byte)0xB8,
|
||||
(byte)0x5D, (byte)0x38, (byte)0xD3, (byte)0x34,
|
||||
(byte)0xFD, (byte)0x7C, (byte)0x17, (byte)0x57,
|
||||
(byte)0x43, (byte)0xA3, (byte)0x1D, (byte)0x18,
|
||||
(byte)0x6C, (byte)0xDE, (byte)0x33, (byte)0x21,
|
||||
(byte)0x2C, (byte)0xB5, (byte)0x2A, (byte)0xFF,
|
||||
(byte)0x3C, (byte)0xE1, (byte)0xB1, (byte)0x29,
|
||||
(byte)0x40, (byte)0x18, (byte)0x11, (byte)0x8D,
|
||||
(byte)0x7C, (byte)0x84, (byte)0xA7, (byte)0x0A,
|
||||
(byte)0x72, (byte)0xD6, (byte)0x86, (byte)0xC4,
|
||||
(byte)0x03, (byte)0x19, (byte)0xC8, (byte)0x07,
|
||||
(byte)0x29, (byte)0x7A, (byte)0xCA, (byte)0x95,
|
||||
(byte)0x0C, (byte)0xD9, (byte)0x96, (byte)0x9F,
|
||||
(byte)0xAB, (byte)0xD0, (byte)0x0A, (byte)0x50,
|
||||
(byte)0x9B, (byte)0x02, (byte)0x46, (byte)0xD3,
|
||||
(byte)0x08, (byte)0x3D, (byte)0x66, (byte)0xA4,
|
||||
(byte)0x5D, (byte)0x41, (byte)0x9F, (byte)0x9C,
|
||||
(byte)0x7C, (byte)0xBD, (byte)0x89, (byte)0x4B,
|
||||
(byte)0x22, (byte)0x19, (byte)0x26, (byte)0xBA,
|
||||
(byte)0xAB, (byte)0xA2, (byte)0x5E, (byte)0xC3,
|
||||
(byte)0x55, (byte)0xE9, (byte)0x2F, (byte)0x78,
|
||||
(byte)0xC7, (byte)0x02, (byte)0x01, (byte)0x02,
|
||||
(byte)0x02, (byte)0x02, (byte)0x02, (byte)0x00,
|
||||
(byte)0x03, (byte)0x81, (byte)0x85, (byte)0x00,
|
||||
(byte)0x02, (byte)0x81, (byte)0x81, (byte)0x00,
|
||||
(byte)0xEE, (byte)0xD6, (byte)0xB1, (byte)0xA3,
|
||||
(byte)0xB4, (byte)0x78, (byte)0x2B, (byte)0x35,
|
||||
(byte)0xEF, (byte)0xCD, (byte)0x17, (byte)0x86,
|
||||
(byte)0x63, (byte)0x2B, (byte)0x97, (byte)0x0E,
|
||||
(byte)0x7A, (byte)0xD1, (byte)0xFF, (byte)0x7A,
|
||||
(byte)0xEB, (byte)0x57, (byte)0x61, (byte)0xA1,
|
||||
(byte)0xF7, (byte)0x90, (byte)0x11, (byte)0xA7,
|
||||
(byte)0x79, (byte)0x28, (byte)0x69, (byte)0xBA,
|
||||
(byte)0xA7, (byte)0xB2, (byte)0x37, (byte)0x17,
|
||||
(byte)0xAE, (byte)0x3C, (byte)0x92, (byte)0x89,
|
||||
(byte)0x88, (byte)0xE5, (byte)0x7E, (byte)0x8E,
|
||||
(byte)0xF0, (byte)0x24, (byte)0xD0, (byte)0xE1,
|
||||
(byte)0xC4, (byte)0xB0, (byte)0x26, (byte)0x5A,
|
||||
(byte)0x1E, (byte)0xBD, (byte)0xA0, (byte)0xCF,
|
||||
(byte)0x3E, (byte)0x97, (byte)0x2A, (byte)0x13,
|
||||
(byte)0x92, (byte)0x3B, (byte)0x39, (byte)0xD0,
|
||||
(byte)0x1D, (byte)0xA3, (byte)0x6B, (byte)0x3E,
|
||||
(byte)0xC2, (byte)0xBB, (byte)0x14, (byte)0xB6,
|
||||
(byte)0xE2, (byte)0x4C, (byte)0x0E, (byte)0x5B,
|
||||
(byte)0x4B, (byte)0xA4, (byte)0x9D, (byte)0xA6,
|
||||
(byte)0x21, (byte)0xB0, (byte)0xF9, (byte)0xDE,
|
||||
(byte)0x55, (byte)0xAE, (byte)0x5C, (byte)0x29,
|
||||
(byte)0x0E, (byte)0xC1, (byte)0xFC, (byte)0xBA,
|
||||
(byte)0x51, (byte)0xD3, (byte)0xB6, (byte)0x6D,
|
||||
(byte)0x75, (byte)0x72, (byte)0xDF, (byte)0x43,
|
||||
(byte)0xAB, (byte)0x94, (byte)0x21, (byte)0x6E,
|
||||
(byte)0x0C, (byte)0xD1, (byte)0x93, (byte)0x54,
|
||||
(byte)0x56, (byte)0x7D, (byte)0x4B, (byte)0x90,
|
||||
(byte)0xF1, (byte)0x94, (byte)0x45, (byte)0xD4,
|
||||
(byte)0x2A, (byte)0x71, (byte)0xA1, (byte)0xB8,
|
||||
(byte)0xDD, (byte)0xAA, (byte)0x05, (byte)0xF0,
|
||||
(byte)0x27, (byte)0x37, (byte)0xBD, (byte)0x44
|
||||
(byte)0x30, (byte)0x82, (byte)0x02, (byte)0x25,
|
||||
(byte)0x30, (byte)0x82, (byte)0x01, (byte)0x17,
|
||||
(byte)0x06, (byte)0x09, (byte)0x2a, (byte)0x86,
|
||||
(byte)0x48, (byte)0x86, (byte)0xf7, (byte)0x0d,
|
||||
(byte)0x01, (byte)0x03, (byte)0x01, (byte)0x30,
|
||||
(byte)0x82, (byte)0x01, (byte)0x08, (byte)0x02,
|
||||
(byte)0x82, (byte)0x01, (byte)0x01, (byte)0x00,
|
||||
(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
|
||||
(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
|
||||
(byte)0xad, (byte)0xf8, (byte)0x54, (byte)0x58,
|
||||
(byte)0xa2, (byte)0xbb, (byte)0x4a, (byte)0x9a,
|
||||
(byte)0xaf, (byte)0xdc, (byte)0x56, (byte)0x20,
|
||||
(byte)0x27, (byte)0x3d, (byte)0x3c, (byte)0xf1,
|
||||
(byte)0xd8, (byte)0xb9, (byte)0xc5, (byte)0x83,
|
||||
(byte)0xce, (byte)0x2d, (byte)0x36, (byte)0x95,
|
||||
(byte)0xa9, (byte)0xe1, (byte)0x36, (byte)0x41,
|
||||
(byte)0x14, (byte)0x64, (byte)0x33, (byte)0xfb,
|
||||
(byte)0xcc, (byte)0x93, (byte)0x9d, (byte)0xce,
|
||||
(byte)0x24, (byte)0x9b, (byte)0x3e, (byte)0xf9,
|
||||
(byte)0x7d, (byte)0x2f, (byte)0xe3, (byte)0x63,
|
||||
(byte)0x63, (byte)0x0c, (byte)0x75, (byte)0xd8,
|
||||
(byte)0xf6, (byte)0x81, (byte)0xb2, (byte)0x02,
|
||||
(byte)0xae, (byte)0xc4, (byte)0x61, (byte)0x7a,
|
||||
(byte)0xd3, (byte)0xdf, (byte)0x1e, (byte)0xd5,
|
||||
(byte)0xd5, (byte)0xfd, (byte)0x65, (byte)0x61,
|
||||
(byte)0x24, (byte)0x33, (byte)0xf5, (byte)0x1f,
|
||||
(byte)0x5f, (byte)0x06, (byte)0x6e, (byte)0xd0,
|
||||
(byte)0x85, (byte)0x63, (byte)0x65, (byte)0x55,
|
||||
(byte)0x3d, (byte)0xed, (byte)0x1a, (byte)0xf3,
|
||||
(byte)0xb5, (byte)0x57, (byte)0x13, (byte)0x5e,
|
||||
(byte)0x7f, (byte)0x57, (byte)0xc9, (byte)0x35,
|
||||
(byte)0x98, (byte)0x4f, (byte)0x0c, (byte)0x70,
|
||||
(byte)0xe0, (byte)0xe6, (byte)0x8b, (byte)0x77,
|
||||
(byte)0xe2, (byte)0xa6, (byte)0x89, (byte)0xda,
|
||||
(byte)0xf3, (byte)0xef, (byte)0xe8, (byte)0x72,
|
||||
(byte)0x1d, (byte)0xf1, (byte)0x58, (byte)0xa1,
|
||||
(byte)0x36, (byte)0xad, (byte)0xe7, (byte)0x35,
|
||||
(byte)0x30, (byte)0xac, (byte)0xca, (byte)0x4f,
|
||||
(byte)0x48, (byte)0x3a, (byte)0x79, (byte)0x7a,
|
||||
(byte)0xbc, (byte)0x0a, (byte)0xb1, (byte)0x82,
|
||||
(byte)0xb3, (byte)0x24, (byte)0xfb, (byte)0x61,
|
||||
(byte)0xd1, (byte)0x08, (byte)0xa9, (byte)0x4b,
|
||||
(byte)0xb2, (byte)0xc8, (byte)0xe3, (byte)0xfb,
|
||||
(byte)0xb9, (byte)0x6a, (byte)0xda, (byte)0xb7,
|
||||
(byte)0x60, (byte)0xd7, (byte)0xf4, (byte)0x68,
|
||||
(byte)0x1d, (byte)0x4f, (byte)0x42, (byte)0xa3,
|
||||
(byte)0xde, (byte)0x39, (byte)0x4d, (byte)0xf4,
|
||||
(byte)0xae, (byte)0x56, (byte)0xed, (byte)0xe7,
|
||||
(byte)0x63, (byte)0x72, (byte)0xbb, (byte)0x19,
|
||||
(byte)0x0b, (byte)0x07, (byte)0xa7, (byte)0xc8,
|
||||
(byte)0xee, (byte)0x0a, (byte)0x6d, (byte)0x70,
|
||||
(byte)0x9e, (byte)0x02, (byte)0xfc, (byte)0xe1,
|
||||
(byte)0xcd, (byte)0xf7, (byte)0xe2, (byte)0xec,
|
||||
(byte)0xc0, (byte)0x34, (byte)0x04, (byte)0xcd,
|
||||
(byte)0x28, (byte)0x34, (byte)0x2f, (byte)0x61,
|
||||
(byte)0x91, (byte)0x72, (byte)0xfe, (byte)0x9c,
|
||||
(byte)0xe9, (byte)0x85, (byte)0x83, (byte)0xff,
|
||||
(byte)0x8e, (byte)0x4f, (byte)0x12, (byte)0x32,
|
||||
(byte)0xee, (byte)0xf2, (byte)0x81, (byte)0x83,
|
||||
(byte)0xc3, (byte)0xfe, (byte)0x3b, (byte)0x1b,
|
||||
(byte)0x4c, (byte)0x6f, (byte)0xad, (byte)0x73,
|
||||
(byte)0x3b, (byte)0xb5, (byte)0xfc, (byte)0xbc,
|
||||
(byte)0x2e, (byte)0xc2, (byte)0x20, (byte)0x05,
|
||||
(byte)0xc5, (byte)0x8e, (byte)0xf1, (byte)0x83,
|
||||
(byte)0x7d, (byte)0x16, (byte)0x83, (byte)0xb2,
|
||||
(byte)0xc6, (byte)0xf3, (byte)0x4a, (byte)0x26,
|
||||
(byte)0xc1, (byte)0xb2, (byte)0xef, (byte)0xfa,
|
||||
(byte)0x88, (byte)0x6b, (byte)0x42, (byte)0x38,
|
||||
(byte)0x61, (byte)0x28, (byte)0x5c, (byte)0x97,
|
||||
(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
|
||||
(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
|
||||
(byte)0x02, (byte)0x01, (byte)0x02, (byte)0x03,
|
||||
(byte)0x82, (byte)0x01, (byte)0x06, (byte)0x00,
|
||||
(byte)0x02, (byte)0x82, (byte)0x01, (byte)0x01,
|
||||
(byte)0x00, (byte)0xb0, (byte)0x6e, (byte)0x76,
|
||||
(byte)0x73, (byte)0x32, (byte)0xd4, (byte)0xcf,
|
||||
(byte)0xb8, (byte)0x16, (byte)0x46, (byte)0x76,
|
||||
(byte)0x8b, (byte)0x2b, (byte)0x2b, (byte)0xda,
|
||||
(byte)0x6e, (byte)0x25, (byte)0x52, (byte)0x87,
|
||||
(byte)0x9e, (byte)0x0c, (byte)0x97, (byte)0xc7,
|
||||
(byte)0x16, (byte)0x42, (byte)0xb6, (byte)0x30,
|
||||
(byte)0xc6, (byte)0x30, (byte)0xce, (byte)0xc5,
|
||||
(byte)0xf4, (byte)0x8e, (byte)0x28, (byte)0xe0,
|
||||
(byte)0x8d, (byte)0x5b, (byte)0x44, (byte)0x59,
|
||||
(byte)0xae, (byte)0x5e, (byte)0xb6, (byte)0x5f,
|
||||
(byte)0x48, (byte)0x8e, (byte)0x13, (byte)0x91,
|
||||
(byte)0x00, (byte)0x72, (byte)0x9b, (byte)0x1b,
|
||||
(byte)0xd8, (byte)0x69, (byte)0xe4, (byte)0xdf,
|
||||
(byte)0x10, (byte)0x50, (byte)0x53, (byte)0x0f,
|
||||
(byte)0x3d, (byte)0xba, (byte)0x82, (byte)0x02,
|
||||
(byte)0x1c, (byte)0x78, (byte)0xf3, (byte)0xf3,
|
||||
(byte)0x9a, (byte)0x01, (byte)0x3d, (byte)0xb6,
|
||||
(byte)0x65, (byte)0xc2, (byte)0x6f, (byte)0x70,
|
||||
(byte)0xec, (byte)0x67, (byte)0x14, (byte)0x56,
|
||||
(byte)0xa0, (byte)0x98, (byte)0xef, (byte)0xc8,
|
||||
(byte)0x63, (byte)0xbe, (byte)0x14, (byte)0x78,
|
||||
(byte)0x1d, (byte)0xff, (byte)0xf8, (byte)0xf9,
|
||||
(byte)0xd9, (byte)0x53, (byte)0xb2, (byte)0xc4,
|
||||
(byte)0x40, (byte)0x3e, (byte)0x90, (byte)0x5c,
|
||||
(byte)0x10, (byte)0xf8, (byte)0xa4, (byte)0xd3,
|
||||
(byte)0xa2, (byte)0x39, (byte)0xc6, (byte)0xeb,
|
||||
(byte)0xcd, (byte)0x3d, (byte)0xd1, (byte)0x27,
|
||||
(byte)0x51, (byte)0xc8, (byte)0x4f, (byte)0x9b,
|
||||
(byte)0x86, (byte)0xce, (byte)0xcf, (byte)0x80,
|
||||
(byte)0x96, (byte)0x3d, (byte)0xb9, (byte)0x25,
|
||||
(byte)0x05, (byte)0x54, (byte)0x15, (byte)0x8d,
|
||||
(byte)0x02, (byte)0xd2, (byte)0x6f, (byte)0xed,
|
||||
(byte)0xaf, (byte)0x49, (byte)0x0d, (byte)0x3e,
|
||||
(byte)0xda, (byte)0xe6, (byte)0x3d, (byte)0x1a,
|
||||
(byte)0x91, (byte)0x8f, (byte)0xca, (byte)0x6d,
|
||||
(byte)0x88, (byte)0xff, (byte)0x0f, (byte)0x75,
|
||||
(byte)0xf5, (byte)0x4e, (byte)0x08, (byte)0x42,
|
||||
(byte)0xf0, (byte)0xa3, (byte)0x4a, (byte)0x95,
|
||||
(byte)0xca, (byte)0x18, (byte)0xc1, (byte)0x3d,
|
||||
(byte)0x9a, (byte)0x12, (byte)0x3e, (byte)0x09,
|
||||
(byte)0x29, (byte)0x82, (byte)0x8e, (byte)0xe5,
|
||||
(byte)0x3a, (byte)0x4c, (byte)0xcc, (byte)0x8f,
|
||||
(byte)0x94, (byte)0x14, (byte)0xe3, (byte)0xc7,
|
||||
(byte)0x63, (byte)0x8a, (byte)0x23, (byte)0x11,
|
||||
(byte)0x03, (byte)0x77, (byte)0x7d, (byte)0xe8,
|
||||
(byte)0x03, (byte)0x15, (byte)0x37, (byte)0xa9,
|
||||
(byte)0xe5, (byte)0xd7, (byte)0x38, (byte)0x8f,
|
||||
(byte)0xa8, (byte)0x49, (byte)0x5d, (byte)0xe4,
|
||||
(byte)0x0d, (byte)0xed, (byte)0xb9, (byte)0x92,
|
||||
(byte)0xc4, (byte)0xd7, (byte)0x72, (byte)0xf2,
|
||||
(byte)0x29, (byte)0x26, (byte)0x99, (byte)0x11,
|
||||
(byte)0xac, (byte)0xa8, (byte)0x45, (byte)0xb1,
|
||||
(byte)0x6b, (byte)0x5a, (byte)0x01, (byte)0xc4,
|
||||
(byte)0xe0, (byte)0x08, (byte)0xbf, (byte)0xa1,
|
||||
(byte)0x49, (byte)0x2a, (byte)0x9c, (byte)0x8c,
|
||||
(byte)0x89, (byte)0x31, (byte)0x07, (byte)0x36,
|
||||
(byte)0x7d, (byte)0xec, (byte)0xa3, (byte)0x9a,
|
||||
(byte)0x1e, (byte)0xd6, (byte)0xc6, (byte)0x01,
|
||||
(byte)0x0e, (byte)0xc8, (byte)0x85, (byte)0x55,
|
||||
(byte)0x42, (byte)0xa4, (byte)0x87, (byte)0x58,
|
||||
(byte)0xfa, (byte)0xec, (byte)0x71, (byte)0x2e,
|
||||
(byte)0x4c, (byte)0x46, (byte)0xd2, (byte)0x19,
|
||||
(byte)0x23, (byte)0x0a, (byte)0x59, (byte)0x1a,
|
||||
(byte)0x56
|
||||
};
|
||||
|
||||
private static final byte alicePrivKeyEnc[] = {
|
||||
(byte)0x30, (byte)0x81, (byte)0xE3, (byte)0x02,
|
||||
(byte)0x01, (byte)0x00, (byte)0x30, (byte)0x81,
|
||||
(byte)0x99, (byte)0x06, (byte)0x09, (byte)0x2A,
|
||||
(byte)0x86, (byte)0x48, (byte)0x86, (byte)0xF7,
|
||||
(byte)0x0D, (byte)0x01, (byte)0x03, (byte)0x01,
|
||||
(byte)0x30, (byte)0x81, (byte)0x8B, (byte)0x02,
|
||||
(byte)0x81, (byte)0x81, (byte)0x00, (byte)0xF4,
|
||||
(byte)0x88, (byte)0xFD, (byte)0x58, (byte)0x4E,
|
||||
(byte)0x49, (byte)0xDB, (byte)0xCD, (byte)0x20,
|
||||
(byte)0xB4, (byte)0x9D, (byte)0xE4, (byte)0x91,
|
||||
(byte)0x07, (byte)0x36, (byte)0x6B, (byte)0x33,
|
||||
(byte)0x6C, (byte)0x38, (byte)0x0D, (byte)0x45,
|
||||
(byte)0x1D, (byte)0x0F, (byte)0x7C, (byte)0x88,
|
||||
(byte)0xB3, (byte)0x1C, (byte)0x7C, (byte)0x5B,
|
||||
(byte)0x2D, (byte)0x8E, (byte)0xF6, (byte)0xF3,
|
||||
(byte)0xC9, (byte)0x23, (byte)0xC0, (byte)0x43,
|
||||
(byte)0xF0, (byte)0xA5, (byte)0x5B, (byte)0x18,
|
||||
(byte)0x8D, (byte)0x8E, (byte)0xBB, (byte)0x55,
|
||||
(byte)0x8C, (byte)0xB8, (byte)0x5D, (byte)0x38,
|
||||
(byte)0xD3, (byte)0x34, (byte)0xFD, (byte)0x7C,
|
||||
(byte)0x17, (byte)0x57, (byte)0x43, (byte)0xA3,
|
||||
(byte)0x1D, (byte)0x18, (byte)0x6C, (byte)0xDE,
|
||||
(byte)0x33, (byte)0x21, (byte)0x2C, (byte)0xB5,
|
||||
(byte)0x2A, (byte)0xFF, (byte)0x3C, (byte)0xE1,
|
||||
(byte)0xB1, (byte)0x29, (byte)0x40, (byte)0x18,
|
||||
(byte)0x11, (byte)0x8D, (byte)0x7C, (byte)0x84,
|
||||
(byte)0xA7, (byte)0x0A, (byte)0x72, (byte)0xD6,
|
||||
(byte)0x86, (byte)0xC4, (byte)0x03, (byte)0x19,
|
||||
(byte)0xC8, (byte)0x07, (byte)0x29, (byte)0x7A,
|
||||
(byte)0xCA, (byte)0x95, (byte)0x0C, (byte)0xD9,
|
||||
(byte)0x96, (byte)0x9F, (byte)0xAB, (byte)0xD0,
|
||||
(byte)0x0A, (byte)0x50, (byte)0x9B, (byte)0x02,
|
||||
(byte)0x46, (byte)0xD3, (byte)0x08, (byte)0x3D,
|
||||
(byte)0x66, (byte)0xA4, (byte)0x5D, (byte)0x41,
|
||||
(byte)0x9F, (byte)0x9C, (byte)0x7C, (byte)0xBD,
|
||||
(byte)0x89, (byte)0x4B, (byte)0x22, (byte)0x19,
|
||||
(byte)0x26, (byte)0xBA, (byte)0xAB, (byte)0xA2,
|
||||
(byte)0x5E, (byte)0xC3, (byte)0x55, (byte)0xE9,
|
||||
(byte)0x2F, (byte)0x78, (byte)0xC7, (byte)0x02,
|
||||
(byte)0x01, (byte)0x02, (byte)0x02, (byte)0x02,
|
||||
(byte)0x02, (byte)0x00, (byte)0x04, (byte)0x42,
|
||||
(byte)0x02, (byte)0x40, (byte)0x36, (byte)0x4D,
|
||||
(byte)0xD0, (byte)0x58, (byte)0x64, (byte)0x91,
|
||||
(byte)0x78, (byte)0xA2, (byte)0x4B, (byte)0x79,
|
||||
(byte)0x46, (byte)0xFE, (byte)0xC9, (byte)0xD9,
|
||||
(byte)0xCA, (byte)0x5C, (byte)0xF9, (byte)0xFD,
|
||||
(byte)0x6C, (byte)0x5D, (byte)0x76, (byte)0x3A,
|
||||
(byte)0x41, (byte)0x6D, (byte)0x44, (byte)0x62,
|
||||
(byte)0x75, (byte)0x93, (byte)0x81, (byte)0x93,
|
||||
(byte)0x00, (byte)0x4C, (byte)0xB1, (byte)0xD8,
|
||||
(byte)0x7D, (byte)0x9D, (byte)0xF3, (byte)0x16,
|
||||
(byte)0x2C, (byte)0x6C, (byte)0x9F, (byte)0x7A,
|
||||
(byte)0x84, (byte)0xA3, (byte)0x7A, (byte)0xC1,
|
||||
(byte)0x4F, (byte)0x60, (byte)0xE3, (byte)0xB5,
|
||||
(byte)0x86, (byte)0x28, (byte)0x08, (byte)0x4D,
|
||||
(byte)0x94, (byte)0xB6, (byte)0x04, (byte)0x0D,
|
||||
(byte)0xAC, (byte)0xBD, (byte)0x1F, (byte)0x42,
|
||||
(byte)0x8F, (byte)0x1B
|
||||
(byte)0x30, (byte)0x82, (byte)0x01, (byte)0x3f,
|
||||
(byte)0x02, (byte)0x01, (byte)0x00, (byte)0x30,
|
||||
(byte)0x82, (byte)0x01, (byte)0x17, (byte)0x06,
|
||||
(byte)0x09, (byte)0x2a, (byte)0x86, (byte)0x48,
|
||||
(byte)0x86, (byte)0xf7, (byte)0x0d, (byte)0x01,
|
||||
(byte)0x03, (byte)0x01, (byte)0x30, (byte)0x82,
|
||||
(byte)0x01, (byte)0x08, (byte)0x02, (byte)0x82,
|
||||
(byte)0x01, (byte)0x01, (byte)0x00, (byte)0xff,
|
||||
(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
|
||||
(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xad,
|
||||
(byte)0xf8, (byte)0x54, (byte)0x58, (byte)0xa2,
|
||||
(byte)0xbb, (byte)0x4a, (byte)0x9a, (byte)0xaf,
|
||||
(byte)0xdc, (byte)0x56, (byte)0x20, (byte)0x27,
|
||||
(byte)0x3d, (byte)0x3c, (byte)0xf1, (byte)0xd8,
|
||||
(byte)0xb9, (byte)0xc5, (byte)0x83, (byte)0xce,
|
||||
(byte)0x2d, (byte)0x36, (byte)0x95, (byte)0xa9,
|
||||
(byte)0xe1, (byte)0x36, (byte)0x41, (byte)0x14,
|
||||
(byte)0x64, (byte)0x33, (byte)0xfb, (byte)0xcc,
|
||||
(byte)0x93, (byte)0x9d, (byte)0xce, (byte)0x24,
|
||||
(byte)0x9b, (byte)0x3e, (byte)0xf9, (byte)0x7d,
|
||||
(byte)0x2f, (byte)0xe3, (byte)0x63, (byte)0x63,
|
||||
(byte)0x0c, (byte)0x75, (byte)0xd8, (byte)0xf6,
|
||||
(byte)0x81, (byte)0xb2, (byte)0x02, (byte)0xae,
|
||||
(byte)0xc4, (byte)0x61, (byte)0x7a, (byte)0xd3,
|
||||
(byte)0xdf, (byte)0x1e, (byte)0xd5, (byte)0xd5,
|
||||
(byte)0xfd, (byte)0x65, (byte)0x61, (byte)0x24,
|
||||
(byte)0x33, (byte)0xf5, (byte)0x1f, (byte)0x5f,
|
||||
(byte)0x06, (byte)0x6e, (byte)0xd0, (byte)0x85,
|
||||
(byte)0x63, (byte)0x65, (byte)0x55, (byte)0x3d,
|
||||
(byte)0xed, (byte)0x1a, (byte)0xf3, (byte)0xb5,
|
||||
(byte)0x57, (byte)0x13, (byte)0x5e, (byte)0x7f,
|
||||
(byte)0x57, (byte)0xc9, (byte)0x35, (byte)0x98,
|
||||
(byte)0x4f, (byte)0x0c, (byte)0x70, (byte)0xe0,
|
||||
(byte)0xe6, (byte)0x8b, (byte)0x77, (byte)0xe2,
|
||||
(byte)0xa6, (byte)0x89, (byte)0xda, (byte)0xf3,
|
||||
(byte)0xef, (byte)0xe8, (byte)0x72, (byte)0x1d,
|
||||
(byte)0xf1, (byte)0x58, (byte)0xa1, (byte)0x36,
|
||||
(byte)0xad, (byte)0xe7, (byte)0x35, (byte)0x30,
|
||||
(byte)0xac, (byte)0xca, (byte)0x4f, (byte)0x48,
|
||||
(byte)0x3a, (byte)0x79, (byte)0x7a, (byte)0xbc,
|
||||
(byte)0x0a, (byte)0xb1, (byte)0x82, (byte)0xb3,
|
||||
(byte)0x24, (byte)0xfb, (byte)0x61, (byte)0xd1,
|
||||
(byte)0x08, (byte)0xa9, (byte)0x4b, (byte)0xb2,
|
||||
(byte)0xc8, (byte)0xe3, (byte)0xfb, (byte)0xb9,
|
||||
(byte)0x6a, (byte)0xda, (byte)0xb7, (byte)0x60,
|
||||
(byte)0xd7, (byte)0xf4, (byte)0x68, (byte)0x1d,
|
||||
(byte)0x4f, (byte)0x42, (byte)0xa3, (byte)0xde,
|
||||
(byte)0x39, (byte)0x4d, (byte)0xf4, (byte)0xae,
|
||||
(byte)0x56, (byte)0xed, (byte)0xe7, (byte)0x63,
|
||||
(byte)0x72, (byte)0xbb, (byte)0x19, (byte)0x0b,
|
||||
(byte)0x07, (byte)0xa7, (byte)0xc8, (byte)0xee,
|
||||
(byte)0x0a, (byte)0x6d, (byte)0x70, (byte)0x9e,
|
||||
(byte)0x02, (byte)0xfc, (byte)0xe1, (byte)0xcd,
|
||||
(byte)0xf7, (byte)0xe2, (byte)0xec, (byte)0xc0,
|
||||
(byte)0x34, (byte)0x04, (byte)0xcd, (byte)0x28,
|
||||
(byte)0x34, (byte)0x2f, (byte)0x61, (byte)0x91,
|
||||
(byte)0x72, (byte)0xfe, (byte)0x9c, (byte)0xe9,
|
||||
(byte)0x85, (byte)0x83, (byte)0xff, (byte)0x8e,
|
||||
(byte)0x4f, (byte)0x12, (byte)0x32, (byte)0xee,
|
||||
(byte)0xf2, (byte)0x81, (byte)0x83, (byte)0xc3,
|
||||
(byte)0xfe, (byte)0x3b, (byte)0x1b, (byte)0x4c,
|
||||
(byte)0x6f, (byte)0xad, (byte)0x73, (byte)0x3b,
|
||||
(byte)0xb5, (byte)0xfc, (byte)0xbc, (byte)0x2e,
|
||||
(byte)0xc2, (byte)0x20, (byte)0x05, (byte)0xc5,
|
||||
(byte)0x8e, (byte)0xf1, (byte)0x83, (byte)0x7d,
|
||||
(byte)0x16, (byte)0x83, (byte)0xb2, (byte)0xc6,
|
||||
(byte)0xf3, (byte)0x4a, (byte)0x26, (byte)0xc1,
|
||||
(byte)0xb2, (byte)0xef, (byte)0xfa, (byte)0x88,
|
||||
(byte)0x6b, (byte)0x42, (byte)0x38, (byte)0x61,
|
||||
(byte)0x28, (byte)0x5c, (byte)0x97, (byte)0xff,
|
||||
(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
|
||||
(byte)0xff, (byte)0xff, (byte)0xff, (byte)0x02,
|
||||
(byte)0x01, (byte)0x02, (byte)0x04, (byte)0x1f,
|
||||
(byte)0x02, (byte)0x1d, (byte)0x00, (byte)0xc7,
|
||||
(byte)0x06, (byte)0xe9, (byte)0x24, (byte)0xf8,
|
||||
(byte)0xb1, (byte)0xdf, (byte)0x98, (byte)0x61,
|
||||
(byte)0x34, (byte)0x7f, (byte)0xcf, (byte)0xf1,
|
||||
(byte)0xcc, (byte)0xcd, (byte)0xc8, (byte)0xcc,
|
||||
(byte)0xd9, (byte)0x6a, (byte)0xb8, (byte)0x7d,
|
||||
(byte)0x72, (byte)0x4c, (byte)0x58, (byte)0x5a,
|
||||
(byte)0x97, (byte)0x39, (byte)0x69
|
||||
};
|
||||
|
||||
private static final byte bobPubKeyEnc[] = {
|
||||
(byte)0x30, (byte)0x82, (byte)0x01, (byte)0x23,
|
||||
(byte)0x30, (byte)0x81, (byte)0x99, (byte)0x06,
|
||||
(byte)0x09, (byte)0x2A, (byte)0x86, (byte)0x48,
|
||||
(byte)0x86, (byte)0xF7, (byte)0x0D, (byte)0x01,
|
||||
(byte)0x03, (byte)0x01, (byte)0x30, (byte)0x81,
|
||||
(byte)0x8B, (byte)0x02, (byte)0x81, (byte)0x81,
|
||||
(byte)0x00, (byte)0xF4, (byte)0x88, (byte)0xFD,
|
||||
(byte)0x58, (byte)0x4E, (byte)0x49, (byte)0xDB,
|
||||
(byte)0xCD, (byte)0x20, (byte)0xB4, (byte)0x9D,
|
||||
(byte)0xE4, (byte)0x91, (byte)0x07, (byte)0x36,
|
||||
(byte)0x6B, (byte)0x33, (byte)0x6C, (byte)0x38,
|
||||
(byte)0x0D, (byte)0x45, (byte)0x1D, (byte)0x0F,
|
||||
(byte)0x7C, (byte)0x88, (byte)0xB3, (byte)0x1C,
|
||||
(byte)0x7C, (byte)0x5B, (byte)0x2D, (byte)0x8E,
|
||||
(byte)0xF6, (byte)0xF3, (byte)0xC9, (byte)0x23,
|
||||
(byte)0xC0, (byte)0x43, (byte)0xF0, (byte)0xA5,
|
||||
(byte)0x5B, (byte)0x18, (byte)0x8D, (byte)0x8E,
|
||||
(byte)0xBB, (byte)0x55, (byte)0x8C, (byte)0xB8,
|
||||
(byte)0x5D, (byte)0x38, (byte)0xD3, (byte)0x34,
|
||||
(byte)0xFD, (byte)0x7C, (byte)0x17, (byte)0x57,
|
||||
(byte)0x43, (byte)0xA3, (byte)0x1D, (byte)0x18,
|
||||
(byte)0x6C, (byte)0xDE, (byte)0x33, (byte)0x21,
|
||||
(byte)0x2C, (byte)0xB5, (byte)0x2A, (byte)0xFF,
|
||||
(byte)0x3C, (byte)0xE1, (byte)0xB1, (byte)0x29,
|
||||
(byte)0x40, (byte)0x18, (byte)0x11, (byte)0x8D,
|
||||
(byte)0x7C, (byte)0x84, (byte)0xA7, (byte)0x0A,
|
||||
(byte)0x72, (byte)0xD6, (byte)0x86, (byte)0xC4,
|
||||
(byte)0x03, (byte)0x19, (byte)0xC8, (byte)0x07,
|
||||
(byte)0x29, (byte)0x7A, (byte)0xCA, (byte)0x95,
|
||||
(byte)0x0C, (byte)0xD9, (byte)0x96, (byte)0x9F,
|
||||
(byte)0xAB, (byte)0xD0, (byte)0x0A, (byte)0x50,
|
||||
(byte)0x9B, (byte)0x02, (byte)0x46, (byte)0xD3,
|
||||
(byte)0x08, (byte)0x3D, (byte)0x66, (byte)0xA4,
|
||||
(byte)0x5D, (byte)0x41, (byte)0x9F, (byte)0x9C,
|
||||
(byte)0x7C, (byte)0xBD, (byte)0x89, (byte)0x4B,
|
||||
(byte)0x22, (byte)0x19, (byte)0x26, (byte)0xBA,
|
||||
(byte)0xAB, (byte)0xA2, (byte)0x5E, (byte)0xC3,
|
||||
(byte)0x55, (byte)0xE9, (byte)0x2F, (byte)0x78,
|
||||
(byte)0xC7, (byte)0x02, (byte)0x01, (byte)0x02,
|
||||
(byte)0x02, (byte)0x02, (byte)0x02, (byte)0x00,
|
||||
(byte)0x03, (byte)0x81, (byte)0x84, (byte)0x00,
|
||||
(byte)0x02, (byte)0x81, (byte)0x80, (byte)0x2C,
|
||||
(byte)0x40, (byte)0xFA, (byte)0xF6, (byte)0xA6,
|
||||
(byte)0xF8, (byte)0xAC, (byte)0xC2, (byte)0x4F,
|
||||
(byte)0xCD, (byte)0xC7, (byte)0x37, (byte)0x93,
|
||||
(byte)0xE5, (byte)0xE4, (byte)0x5E, (byte)0x18,
|
||||
(byte)0x14, (byte)0xE6, (byte)0x50, (byte)0xDA,
|
||||
(byte)0x55, (byte)0x38, (byte)0x5D, (byte)0x24,
|
||||
(byte)0xF5, (byte)0x42, (byte)0x68, (byte)0x5F,
|
||||
(byte)0xF5, (byte)0x15, (byte)0xC8, (byte)0x9B,
|
||||
(byte)0x5D, (byte)0x06, (byte)0x3D, (byte)0xE1,
|
||||
(byte)0x52, (byte)0x2F, (byte)0x98, (byte)0xFF,
|
||||
(byte)0x37, (byte)0xBB, (byte)0x75, (byte)0x48,
|
||||
(byte)0x48, (byte)0xE9, (byte)0x65, (byte)0x84,
|
||||
(byte)0x37, (byte)0xBB, (byte)0xB3, (byte)0xE9,
|
||||
(byte)0x36, (byte)0x01, (byte)0xB4, (byte)0x6A,
|
||||
(byte)0x1C, (byte)0xB2, (byte)0x11, (byte)0x82,
|
||||
(byte)0xCE, (byte)0x3D, (byte)0x65, (byte)0xE5,
|
||||
(byte)0x3C, (byte)0x89, (byte)0xE9, (byte)0x52,
|
||||
(byte)0x19, (byte)0xBD, (byte)0x58, (byte)0xF6,
|
||||
(byte)0xA2, (byte)0x03, (byte)0xA8, (byte)0xB2,
|
||||
(byte)0xA5, (byte)0xDB, (byte)0xEB, (byte)0xF5,
|
||||
(byte)0x94, (byte)0xF9, (byte)0x46, (byte)0xBE,
|
||||
(byte)0x45, (byte)0x4C, (byte)0x65, (byte)0xD2,
|
||||
(byte)0xD1, (byte)0xCF, (byte)0xFF, (byte)0xFF,
|
||||
(byte)0xFA, (byte)0x38, (byte)0xF1, (byte)0x72,
|
||||
(byte)0xAB, (byte)0xB9, (byte)0x14, (byte)0x4E,
|
||||
(byte)0xF5, (byte)0xF0, (byte)0x7A, (byte)0x8E,
|
||||
(byte)0x45, (byte)0xFD, (byte)0x5B, (byte)0xF9,
|
||||
(byte)0xA2, (byte)0x97, (byte)0x1B, (byte)0xAE,
|
||||
(byte)0x2C, (byte)0x7B, (byte)0x6B, (byte)0x7C,
|
||||
(byte)0x98, (byte)0xFE, (byte)0x58, (byte)0xDD,
|
||||
(byte)0xBE, (byte)0xF6, (byte)0x1C, (byte)0x8E,
|
||||
(byte)0xD0, (byte)0xA1, (byte)0x72
|
||||
(byte)0x30, (byte)0x82, (byte)0x02, (byte)0x25,
|
||||
(byte)0x30, (byte)0x82, (byte)0x01, (byte)0x17,
|
||||
(byte)0x06, (byte)0x09, (byte)0x2a, (byte)0x86,
|
||||
(byte)0x48, (byte)0x86, (byte)0xf7, (byte)0x0d,
|
||||
(byte)0x01, (byte)0x03, (byte)0x01, (byte)0x30,
|
||||
(byte)0x82, (byte)0x01, (byte)0x08, (byte)0x02,
|
||||
(byte)0x82, (byte)0x01, (byte)0x01, (byte)0x00,
|
||||
(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
|
||||
(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
|
||||
(byte)0xad, (byte)0xf8, (byte)0x54, (byte)0x58,
|
||||
(byte)0xa2, (byte)0xbb, (byte)0x4a, (byte)0x9a,
|
||||
(byte)0xaf, (byte)0xdc, (byte)0x56, (byte)0x20,
|
||||
(byte)0x27, (byte)0x3d, (byte)0x3c, (byte)0xf1,
|
||||
(byte)0xd8, (byte)0xb9, (byte)0xc5, (byte)0x83,
|
||||
(byte)0xce, (byte)0x2d, (byte)0x36, (byte)0x95,
|
||||
(byte)0xa9, (byte)0xe1, (byte)0x36, (byte)0x41,
|
||||
(byte)0x14, (byte)0x64, (byte)0x33, (byte)0xfb,
|
||||
(byte)0xcc, (byte)0x93, (byte)0x9d, (byte)0xce,
|
||||
(byte)0x24, (byte)0x9b, (byte)0x3e, (byte)0xf9,
|
||||
(byte)0x7d, (byte)0x2f, (byte)0xe3, (byte)0x63,
|
||||
(byte)0x63, (byte)0x0c, (byte)0x75, (byte)0xd8,
|
||||
(byte)0xf6, (byte)0x81, (byte)0xb2, (byte)0x02,
|
||||
(byte)0xae, (byte)0xc4, (byte)0x61, (byte)0x7a,
|
||||
(byte)0xd3, (byte)0xdf, (byte)0x1e, (byte)0xd5,
|
||||
(byte)0xd5, (byte)0xfd, (byte)0x65, (byte)0x61,
|
||||
(byte)0x24, (byte)0x33, (byte)0xf5, (byte)0x1f,
|
||||
(byte)0x5f, (byte)0x06, (byte)0x6e, (byte)0xd0,
|
||||
(byte)0x85, (byte)0x63, (byte)0x65, (byte)0x55,
|
||||
(byte)0x3d, (byte)0xed, (byte)0x1a, (byte)0xf3,
|
||||
(byte)0xb5, (byte)0x57, (byte)0x13, (byte)0x5e,
|
||||
(byte)0x7f, (byte)0x57, (byte)0xc9, (byte)0x35,
|
||||
(byte)0x98, (byte)0x4f, (byte)0x0c, (byte)0x70,
|
||||
(byte)0xe0, (byte)0xe6, (byte)0x8b, (byte)0x77,
|
||||
(byte)0xe2, (byte)0xa6, (byte)0x89, (byte)0xda,
|
||||
(byte)0xf3, (byte)0xef, (byte)0xe8, (byte)0x72,
|
||||
(byte)0x1d, (byte)0xf1, (byte)0x58, (byte)0xa1,
|
||||
(byte)0x36, (byte)0xad, (byte)0xe7, (byte)0x35,
|
||||
(byte)0x30, (byte)0xac, (byte)0xca, (byte)0x4f,
|
||||
(byte)0x48, (byte)0x3a, (byte)0x79, (byte)0x7a,
|
||||
(byte)0xbc, (byte)0x0a, (byte)0xb1, (byte)0x82,
|
||||
(byte)0xb3, (byte)0x24, (byte)0xfb, (byte)0x61,
|
||||
(byte)0xd1, (byte)0x08, (byte)0xa9, (byte)0x4b,
|
||||
(byte)0xb2, (byte)0xc8, (byte)0xe3, (byte)0xfb,
|
||||
(byte)0xb9, (byte)0x6a, (byte)0xda, (byte)0xb7,
|
||||
(byte)0x60, (byte)0xd7, (byte)0xf4, (byte)0x68,
|
||||
(byte)0x1d, (byte)0x4f, (byte)0x42, (byte)0xa3,
|
||||
(byte)0xde, (byte)0x39, (byte)0x4d, (byte)0xf4,
|
||||
(byte)0xae, (byte)0x56, (byte)0xed, (byte)0xe7,
|
||||
(byte)0x63, (byte)0x72, (byte)0xbb, (byte)0x19,
|
||||
(byte)0x0b, (byte)0x07, (byte)0xa7, (byte)0xc8,
|
||||
(byte)0xee, (byte)0x0a, (byte)0x6d, (byte)0x70,
|
||||
(byte)0x9e, (byte)0x02, (byte)0xfc, (byte)0xe1,
|
||||
(byte)0xcd, (byte)0xf7, (byte)0xe2, (byte)0xec,
|
||||
(byte)0xc0, (byte)0x34, (byte)0x04, (byte)0xcd,
|
||||
(byte)0x28, (byte)0x34, (byte)0x2f, (byte)0x61,
|
||||
(byte)0x91, (byte)0x72, (byte)0xfe, (byte)0x9c,
|
||||
(byte)0xe9, (byte)0x85, (byte)0x83, (byte)0xff,
|
||||
(byte)0x8e, (byte)0x4f, (byte)0x12, (byte)0x32,
|
||||
(byte)0xee, (byte)0xf2, (byte)0x81, (byte)0x83,
|
||||
(byte)0xc3, (byte)0xfe, (byte)0x3b, (byte)0x1b,
|
||||
(byte)0x4c, (byte)0x6f, (byte)0xad, (byte)0x73,
|
||||
(byte)0x3b, (byte)0xb5, (byte)0xfc, (byte)0xbc,
|
||||
(byte)0x2e, (byte)0xc2, (byte)0x20, (byte)0x05,
|
||||
(byte)0xc5, (byte)0x8e, (byte)0xf1, (byte)0x83,
|
||||
(byte)0x7d, (byte)0x16, (byte)0x83, (byte)0xb2,
|
||||
(byte)0xc6, (byte)0xf3, (byte)0x4a, (byte)0x26,
|
||||
(byte)0xc1, (byte)0xb2, (byte)0xef, (byte)0xfa,
|
||||
(byte)0x88, (byte)0x6b, (byte)0x42, (byte)0x38,
|
||||
(byte)0x61, (byte)0x28, (byte)0x5c, (byte)0x97,
|
||||
(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
|
||||
(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
|
||||
(byte)0x02, (byte)0x01, (byte)0x02, (byte)0x03,
|
||||
(byte)0x82, (byte)0x01, (byte)0x06, (byte)0x00,
|
||||
(byte)0x02, (byte)0x82, (byte)0x01, (byte)0x01,
|
||||
(byte)0x00, (byte)0x8d, (byte)0xb4, (byte)0x1c,
|
||||
(byte)0xfc, (byte)0xc0, (byte)0x5f, (byte)0x38,
|
||||
(byte)0x4c, (byte)0x7f, (byte)0x31, (byte)0xaa,
|
||||
(byte)0x03, (byte)0x06, (byte)0xf0, (byte)0xec,
|
||||
(byte)0xfd, (byte)0x45, (byte)0x8d, (byte)0x69,
|
||||
(byte)0x8a, (byte)0xb6, (byte)0x60, (byte)0x2f,
|
||||
(byte)0xa2, (byte)0xb4, (byte)0xda, (byte)0xc0,
|
||||
(byte)0x2e, (byte)0xe1, (byte)0x31, (byte)0x12,
|
||||
(byte)0x5a, (byte)0x49, (byte)0xef, (byte)0xf7,
|
||||
(byte)0x17, (byte)0x77, (byte)0x26, (byte)0xa8,
|
||||
(byte)0x91, (byte)0x0b, (byte)0xbc, (byte)0x84,
|
||||
(byte)0x5c, (byte)0x20, (byte)0x84, (byte)0xd3,
|
||||
(byte)0x38, (byte)0xc9, (byte)0xa1, (byte)0x5b,
|
||||
(byte)0xad, (byte)0x84, (byte)0x83, (byte)0xb9,
|
||||
(byte)0xe1, (byte)0x59, (byte)0x87, (byte)0xd9,
|
||||
(byte)0x9b, (byte)0x36, (byte)0x6b, (byte)0x3c,
|
||||
(byte)0xb6, (byte)0x3c, (byte)0x3a, (byte)0x0c,
|
||||
(byte)0xf4, (byte)0x0b, (byte)0xad, (byte)0x23,
|
||||
(byte)0x8d, (byte)0x5f, (byte)0x80, (byte)0x16,
|
||||
(byte)0xa3, (byte)0x96, (byte)0xbd, (byte)0x28,
|
||||
(byte)0x2f, (byte)0x9f, (byte)0xd1, (byte)0x7e,
|
||||
(byte)0x13, (byte)0x86, (byte)0x6a, (byte)0x22,
|
||||
(byte)0x26, (byte)0xdb, (byte)0x3b, (byte)0x42,
|
||||
(byte)0xf0, (byte)0x21, (byte)0x7a, (byte)0x6c,
|
||||
(byte)0xe3, (byte)0xb0, (byte)0x8d, (byte)0x9c,
|
||||
(byte)0x3b, (byte)0xfb, (byte)0x17, (byte)0x27,
|
||||
(byte)0xde, (byte)0xe4, (byte)0x82, (byte)0x2e,
|
||||
(byte)0x6d, (byte)0x08, (byte)0xeb, (byte)0x2b,
|
||||
(byte)0xb9, (byte)0xb0, (byte)0x94, (byte)0x0e,
|
||||
(byte)0x56, (byte)0xc1, (byte)0xf2, (byte)0x54,
|
||||
(byte)0xd8, (byte)0x94, (byte)0x21, (byte)0xc2,
|
||||
(byte)0x2d, (byte)0x4d, (byte)0x28, (byte)0xf2,
|
||||
(byte)0xc3, (byte)0x96, (byte)0x5b, (byte)0x24,
|
||||
(byte)0xb6, (byte)0xee, (byte)0xa4, (byte)0xbf,
|
||||
(byte)0x20, (byte)0x19, (byte)0x29, (byte)0x1a,
|
||||
(byte)0x55, (byte)0x46, (byte)0x7a, (byte)0x2a,
|
||||
(byte)0x14, (byte)0x12, (byte)0x4d, (byte)0xf4,
|
||||
(byte)0xee, (byte)0xf5, (byte)0x6f, (byte)0x4f,
|
||||
(byte)0xf7, (byte)0x99, (byte)0x1c, (byte)0xa3,
|
||||
(byte)0x72, (byte)0x33, (byte)0x7d, (byte)0xfe,
|
||||
(byte)0xae, (byte)0x0b, (byte)0xda, (byte)0x2c,
|
||||
(byte)0xc7, (byte)0xf3, (byte)0xba, (byte)0xb7,
|
||||
(byte)0x83, (byte)0x58, (byte)0x4c, (byte)0x93,
|
||||
(byte)0x5d, (byte)0x90, (byte)0x65, (byte)0xc9,
|
||||
(byte)0xb8, (byte)0x6d, (byte)0x2d, (byte)0xda,
|
||||
(byte)0x10, (byte)0x55, (byte)0xe6, (byte)0x27,
|
||||
(byte)0xb9, (byte)0x4b, (byte)0x75, (byte)0x30,
|
||||
(byte)0xfa, (byte)0xe4, (byte)0xa3, (byte)0xff,
|
||||
(byte)0xae, (byte)0xf9, (byte)0xfb, (byte)0xe4,
|
||||
(byte)0x62, (byte)0x89, (byte)0x7c, (byte)0x7d,
|
||||
(byte)0x20, (byte)0x50, (byte)0xf9, (byte)0xd1,
|
||||
(byte)0xe2, (byte)0x0e, (byte)0x56, (byte)0xf6,
|
||||
(byte)0x3c, (byte)0x8b, (byte)0x24, (byte)0x8a,
|
||||
(byte)0x6d, (byte)0x92, (byte)0x3f, (byte)0x85,
|
||||
(byte)0x7b, (byte)0x3b, (byte)0x49, (byte)0x21,
|
||||
(byte)0x9d, (byte)0x26, (byte)0x1b, (byte)0x58,
|
||||
(byte)0x08, (byte)0x9e, (byte)0x5f, (byte)0xea,
|
||||
(byte)0x23, (byte)0x20, (byte)0xc2, (byte)0x3d,
|
||||
(byte)0x87, (byte)0xbe, (byte)0x1a, (byte)0x17,
|
||||
(byte)0x34, (byte)0xd8, (byte)0x10, (byte)0x0f,
|
||||
(byte)0x81, (byte)0xb6, (byte)0xc7, (byte)0xa5,
|
||||
(byte)0xe9, (byte)0x8b, (byte)0x21, (byte)0xab,
|
||||
(byte)0x09, (byte)0x88, (byte)0x5e, (byte)0xbd,
|
||||
(byte)0xa2, (byte)0x8a, (byte)0xc4, (byte)0xa8,
|
||||
(byte)0x83
|
||||
};
|
||||
|
||||
private static final byte bobPrivKeyEnc[] = {
|
||||
(byte)0x30, (byte)0x81, (byte)0xE4, (byte)0x02,
|
||||
(byte)0x01, (byte)0x00, (byte)0x30, (byte)0x81,
|
||||
(byte)0x99, (byte)0x06, (byte)0x09, (byte)0x2A,
|
||||
(byte)0x86, (byte)0x48, (byte)0x86, (byte)0xF7,
|
||||
(byte)0x0D, (byte)0x01, (byte)0x03, (byte)0x01,
|
||||
(byte)0x30, (byte)0x81, (byte)0x8B, (byte)0x02,
|
||||
(byte)0x81, (byte)0x81, (byte)0x00, (byte)0xF4,
|
||||
(byte)0x88, (byte)0xFD, (byte)0x58, (byte)0x4E,
|
||||
(byte)0x49, (byte)0xDB, (byte)0xCD, (byte)0x20,
|
||||
(byte)0xB4, (byte)0x9D, (byte)0xE4, (byte)0x91,
|
||||
(byte)0x07, (byte)0x36, (byte)0x6B, (byte)0x33,
|
||||
(byte)0x6C, (byte)0x38, (byte)0x0D, (byte)0x45,
|
||||
(byte)0x1D, (byte)0x0F, (byte)0x7C, (byte)0x88,
|
||||
(byte)0xB3, (byte)0x1C, (byte)0x7C, (byte)0x5B,
|
||||
(byte)0x2D, (byte)0x8E, (byte)0xF6, (byte)0xF3,
|
||||
(byte)0xC9, (byte)0x23, (byte)0xC0, (byte)0x43,
|
||||
(byte)0xF0, (byte)0xA5, (byte)0x5B, (byte)0x18,
|
||||
(byte)0x8D, (byte)0x8E, (byte)0xBB, (byte)0x55,
|
||||
(byte)0x8C, (byte)0xB8, (byte)0x5D, (byte)0x38,
|
||||
(byte)0xD3, (byte)0x34, (byte)0xFD, (byte)0x7C,
|
||||
(byte)0x17, (byte)0x57, (byte)0x43, (byte)0xA3,
|
||||
(byte)0x1D, (byte)0x18, (byte)0x6C, (byte)0xDE,
|
||||
(byte)0x33, (byte)0x21, (byte)0x2C, (byte)0xB5,
|
||||
(byte)0x2A, (byte)0xFF, (byte)0x3C, (byte)0xE1,
|
||||
(byte)0xB1, (byte)0x29, (byte)0x40, (byte)0x18,
|
||||
(byte)0x11, (byte)0x8D, (byte)0x7C, (byte)0x84,
|
||||
(byte)0xA7, (byte)0x0A, (byte)0x72, (byte)0xD6,
|
||||
(byte)0x86, (byte)0xC4, (byte)0x03, (byte)0x19,
|
||||
(byte)0xC8, (byte)0x07, (byte)0x29, (byte)0x7A,
|
||||
(byte)0xCA, (byte)0x95, (byte)0x0C, (byte)0xD9,
|
||||
(byte)0x96, (byte)0x9F, (byte)0xAB, (byte)0xD0,
|
||||
(byte)0x0A, (byte)0x50, (byte)0x9B, (byte)0x02,
|
||||
(byte)0x46, (byte)0xD3, (byte)0x08, (byte)0x3D,
|
||||
(byte)0x66, (byte)0xA4, (byte)0x5D, (byte)0x41,
|
||||
(byte)0x9F, (byte)0x9C, (byte)0x7C, (byte)0xBD,
|
||||
(byte)0x89, (byte)0x4B, (byte)0x22, (byte)0x19,
|
||||
(byte)0x26, (byte)0xBA, (byte)0xAB, (byte)0xA2,
|
||||
(byte)0x5E, (byte)0xC3, (byte)0x55, (byte)0xE9,
|
||||
(byte)0x2F, (byte)0x78, (byte)0xC7, (byte)0x02,
|
||||
(byte)0x01, (byte)0x02, (byte)0x02, (byte)0x02,
|
||||
(byte)0x02, (byte)0x00, (byte)0x04, (byte)0x43,
|
||||
(byte)0x02, (byte)0x41, (byte)0x00, (byte)0xE0,
|
||||
(byte)0x31, (byte)0xE7, (byte)0x77, (byte)0xB8,
|
||||
(byte)0xD0, (byte)0x7E, (byte)0x0A, (byte)0x9B,
|
||||
(byte)0x94, (byte)0xD5, (byte)0x3D, (byte)0x33,
|
||||
(byte)0x62, (byte)0x32, (byte)0x51, (byte)0xCE,
|
||||
(byte)0x74, (byte)0x5C, (byte)0xA5, (byte)0x72,
|
||||
(byte)0xD9, (byte)0x36, (byte)0xF3, (byte)0x8A,
|
||||
(byte)0x3F, (byte)0x8B, (byte)0xC6, (byte)0xFE,
|
||||
(byte)0xEF, (byte)0x94, (byte)0x8B, (byte)0x50,
|
||||
(byte)0x41, (byte)0x9B, (byte)0x14, (byte)0xC8,
|
||||
(byte)0xE9, (byte)0x1F, (byte)0x24, (byte)0x1F,
|
||||
(byte)0x65, (byte)0x8E, (byte)0xD3, (byte)0x85,
|
||||
(byte)0xD0, (byte)0x68, (byte)0x6C, (byte)0xF1,
|
||||
(byte)0x79, (byte)0x45, (byte)0xD0, (byte)0x06,
|
||||
(byte)0xA4, (byte)0xB8, (byte)0xE0, (byte)0x64,
|
||||
(byte)0xF5, (byte)0x38, (byte)0x72, (byte)0x97,
|
||||
(byte)0x00, (byte)0x23, (byte)0x5F
|
||||
(byte)0x30, (byte)0x82, (byte)0x01, (byte)0x3f,
|
||||
(byte)0x02, (byte)0x01, (byte)0x00, (byte)0x30,
|
||||
(byte)0x82, (byte)0x01, (byte)0x17, (byte)0x06,
|
||||
(byte)0x09, (byte)0x2a, (byte)0x86, (byte)0x48,
|
||||
(byte)0x86, (byte)0xf7, (byte)0x0d, (byte)0x01,
|
||||
(byte)0x03, (byte)0x01, (byte)0x30, (byte)0x82,
|
||||
(byte)0x01, (byte)0x08, (byte)0x02, (byte)0x82,
|
||||
(byte)0x01, (byte)0x01, (byte)0x00, (byte)0xff,
|
||||
(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
|
||||
(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xad,
|
||||
(byte)0xf8, (byte)0x54, (byte)0x58, (byte)0xa2,
|
||||
(byte)0xbb, (byte)0x4a, (byte)0x9a, (byte)0xaf,
|
||||
(byte)0xdc, (byte)0x56, (byte)0x20, (byte)0x27,
|
||||
(byte)0x3d, (byte)0x3c, (byte)0xf1, (byte)0xd8,
|
||||
(byte)0xb9, (byte)0xc5, (byte)0x83, (byte)0xce,
|
||||
(byte)0x2d, (byte)0x36, (byte)0x95, (byte)0xa9,
|
||||
(byte)0xe1, (byte)0x36, (byte)0x41, (byte)0x14,
|
||||
(byte)0x64, (byte)0x33, (byte)0xfb, (byte)0xcc,
|
||||
(byte)0x93, (byte)0x9d, (byte)0xce, (byte)0x24,
|
||||
(byte)0x9b, (byte)0x3e, (byte)0xf9, (byte)0x7d,
|
||||
(byte)0x2f, (byte)0xe3, (byte)0x63, (byte)0x63,
|
||||
(byte)0x0c, (byte)0x75, (byte)0xd8, (byte)0xf6,
|
||||
(byte)0x81, (byte)0xb2, (byte)0x02, (byte)0xae,
|
||||
(byte)0xc4, (byte)0x61, (byte)0x7a, (byte)0xd3,
|
||||
(byte)0xdf, (byte)0x1e, (byte)0xd5, (byte)0xd5,
|
||||
(byte)0xfd, (byte)0x65, (byte)0x61, (byte)0x24,
|
||||
(byte)0x33, (byte)0xf5, (byte)0x1f, (byte)0x5f,
|
||||
(byte)0x06, (byte)0x6e, (byte)0xd0, (byte)0x85,
|
||||
(byte)0x63, (byte)0x65, (byte)0x55, (byte)0x3d,
|
||||
(byte)0xed, (byte)0x1a, (byte)0xf3, (byte)0xb5,
|
||||
(byte)0x57, (byte)0x13, (byte)0x5e, (byte)0x7f,
|
||||
(byte)0x57, (byte)0xc9, (byte)0x35, (byte)0x98,
|
||||
(byte)0x4f, (byte)0x0c, (byte)0x70, (byte)0xe0,
|
||||
(byte)0xe6, (byte)0x8b, (byte)0x77, (byte)0xe2,
|
||||
(byte)0xa6, (byte)0x89, (byte)0xda, (byte)0xf3,
|
||||
(byte)0xef, (byte)0xe8, (byte)0x72, (byte)0x1d,
|
||||
(byte)0xf1, (byte)0x58, (byte)0xa1, (byte)0x36,
|
||||
(byte)0xad, (byte)0xe7, (byte)0x35, (byte)0x30,
|
||||
(byte)0xac, (byte)0xca, (byte)0x4f, (byte)0x48,
|
||||
(byte)0x3a, (byte)0x79, (byte)0x7a, (byte)0xbc,
|
||||
(byte)0x0a, (byte)0xb1, (byte)0x82, (byte)0xb3,
|
||||
(byte)0x24, (byte)0xfb, (byte)0x61, (byte)0xd1,
|
||||
(byte)0x08, (byte)0xa9, (byte)0x4b, (byte)0xb2,
|
||||
(byte)0xc8, (byte)0xe3, (byte)0xfb, (byte)0xb9,
|
||||
(byte)0x6a, (byte)0xda, (byte)0xb7, (byte)0x60,
|
||||
(byte)0xd7, (byte)0xf4, (byte)0x68, (byte)0x1d,
|
||||
(byte)0x4f, (byte)0x42, (byte)0xa3, (byte)0xde,
|
||||
(byte)0x39, (byte)0x4d, (byte)0xf4, (byte)0xae,
|
||||
(byte)0x56, (byte)0xed, (byte)0xe7, (byte)0x63,
|
||||
(byte)0x72, (byte)0xbb, (byte)0x19, (byte)0x0b,
|
||||
(byte)0x07, (byte)0xa7, (byte)0xc8, (byte)0xee,
|
||||
(byte)0x0a, (byte)0x6d, (byte)0x70, (byte)0x9e,
|
||||
(byte)0x02, (byte)0xfc, (byte)0xe1, (byte)0xcd,
|
||||
(byte)0xf7, (byte)0xe2, (byte)0xec, (byte)0xc0,
|
||||
(byte)0x34, (byte)0x04, (byte)0xcd, (byte)0x28,
|
||||
(byte)0x34, (byte)0x2f, (byte)0x61, (byte)0x91,
|
||||
(byte)0x72, (byte)0xfe, (byte)0x9c, (byte)0xe9,
|
||||
(byte)0x85, (byte)0x83, (byte)0xff, (byte)0x8e,
|
||||
(byte)0x4f, (byte)0x12, (byte)0x32, (byte)0xee,
|
||||
(byte)0xf2, (byte)0x81, (byte)0x83, (byte)0xc3,
|
||||
(byte)0xfe, (byte)0x3b, (byte)0x1b, (byte)0x4c,
|
||||
(byte)0x6f, (byte)0xad, (byte)0x73, (byte)0x3b,
|
||||
(byte)0xb5, (byte)0xfc, (byte)0xbc, (byte)0x2e,
|
||||
(byte)0xc2, (byte)0x20, (byte)0x05, (byte)0xc5,
|
||||
(byte)0x8e, (byte)0xf1, (byte)0x83, (byte)0x7d,
|
||||
(byte)0x16, (byte)0x83, (byte)0xb2, (byte)0xc6,
|
||||
(byte)0xf3, (byte)0x4a, (byte)0x26, (byte)0xc1,
|
||||
(byte)0xb2, (byte)0xef, (byte)0xfa, (byte)0x88,
|
||||
(byte)0x6b, (byte)0x42, (byte)0x38, (byte)0x61,
|
||||
(byte)0x28, (byte)0x5c, (byte)0x97, (byte)0xff,
|
||||
(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
|
||||
(byte)0xff, (byte)0xff, (byte)0xff, (byte)0x02,
|
||||
(byte)0x01, (byte)0x02, (byte)0x04, (byte)0x1f,
|
||||
(byte)0x02, (byte)0x1d, (byte)0x01, (byte)0x62,
|
||||
(byte)0x8e, (byte)0xfc, (byte)0xf3, (byte)0x25,
|
||||
(byte)0xf3, (byte)0x2a, (byte)0xf4, (byte)0x49,
|
||||
(byte)0x20, (byte)0x83, (byte)0x61, (byte)0x7f,
|
||||
(byte)0x97, (byte)0x8f, (byte)0x48, (byte)0xac,
|
||||
(byte)0xf9, (byte)0xc3, (byte)0xad, (byte)0x3c,
|
||||
(byte)0x56, (byte)0x95, (byte)0x1c, (byte)0x85,
|
||||
(byte)0xd3, (byte)0x85, (byte)0xd6
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 4532506 4999599
|
||||
* @library /test/lib
|
||||
* @summary Serializing KeyPair on one VM (Sun),
|
||||
* and Deserializing on another (IBM) fails
|
||||
* @run main/othervm/java.security.policy=Serial.policy Serial
|
||||
@@ -34,6 +35,8 @@ import java.math.BigInteger;
|
||||
import java.security.*;
|
||||
import javax.crypto.*;
|
||||
import javax.crypto.spec.*;
|
||||
import jdk.test.lib.security.DiffieHellmanGroup;
|
||||
import jdk.test.lib.security.SecurityUtils;
|
||||
|
||||
public class Serial {
|
||||
|
||||
@@ -45,8 +48,9 @@ public class Serial {
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
// generate DSA key pair
|
||||
KeyPairGenerator kpg = KeyPairGenerator.getInstance("DSA", SUN);
|
||||
kpg.initialize(512);
|
||||
String kpgAlgorithmDsa = "DSA";
|
||||
KeyPairGenerator kpg = KeyPairGenerator.getInstance(kpgAlgorithmDsa, SUN);
|
||||
kpg.initialize(SecurityUtils.getTestKeySize(kpgAlgorithmDsa));
|
||||
KeyPair dsaKp = kpg.genKeyPair();
|
||||
|
||||
// serialize DSA key pair
|
||||
@@ -67,8 +71,9 @@ public class Serial {
|
||||
}
|
||||
|
||||
// generate RSA key pair
|
||||
kpg = KeyPairGenerator.getInstance("RSA", RSA);
|
||||
kpg.initialize(512);
|
||||
String kpgAlgorithmRsa = "RSA";
|
||||
kpg = KeyPairGenerator.getInstance(kpgAlgorithmRsa, RSA);
|
||||
kpg.initialize(SecurityUtils.getTestKeySize(kpgAlgorithmRsa));
|
||||
KeyPair rsaKp = kpg.genKeyPair();
|
||||
|
||||
// serialize RSA key pair
|
||||
@@ -89,8 +94,9 @@ public class Serial {
|
||||
}
|
||||
|
||||
// generate DH key pair
|
||||
DiffieHellmanGroup dhGroup = SecurityUtils.getTestDHGroup();
|
||||
kpg = KeyPairGenerator.getInstance("DiffieHellman", JCE);
|
||||
kpg.initialize(new DHParameterSpec(skip1024Modulus, skip1024Base));
|
||||
kpg.initialize(new DHParameterSpec(dhGroup.getPrime(), dhGroup.getBase()));
|
||||
KeyPair dhKp = kpg.genKeyPair();
|
||||
|
||||
// serialize DH key pair
|
||||
@@ -197,47 +203,4 @@ public class Serial {
|
||||
throw new SecurityException(algorithm + " test failed");
|
||||
}
|
||||
}
|
||||
|
||||
// The 1024 bit Diffie-Hellman modulus values used by SKIP
|
||||
private static final byte skip1024ModulusBytes[] = {
|
||||
(byte)0xF4, (byte)0x88, (byte)0xFD, (byte)0x58,
|
||||
(byte)0x4E, (byte)0x49, (byte)0xDB, (byte)0xCD,
|
||||
(byte)0x20, (byte)0xB4, (byte)0x9D, (byte)0xE4,
|
||||
(byte)0x91, (byte)0x07, (byte)0x36, (byte)0x6B,
|
||||
(byte)0x33, (byte)0x6C, (byte)0x38, (byte)0x0D,
|
||||
(byte)0x45, (byte)0x1D, (byte)0x0F, (byte)0x7C,
|
||||
(byte)0x88, (byte)0xB3, (byte)0x1C, (byte)0x7C,
|
||||
(byte)0x5B, (byte)0x2D, (byte)0x8E, (byte)0xF6,
|
||||
(byte)0xF3, (byte)0xC9, (byte)0x23, (byte)0xC0,
|
||||
(byte)0x43, (byte)0xF0, (byte)0xA5, (byte)0x5B,
|
||||
(byte)0x18, (byte)0x8D, (byte)0x8E, (byte)0xBB,
|
||||
(byte)0x55, (byte)0x8C, (byte)0xB8, (byte)0x5D,
|
||||
(byte)0x38, (byte)0xD3, (byte)0x34, (byte)0xFD,
|
||||
(byte)0x7C, (byte)0x17, (byte)0x57, (byte)0x43,
|
||||
(byte)0xA3, (byte)0x1D, (byte)0x18, (byte)0x6C,
|
||||
(byte)0xDE, (byte)0x33, (byte)0x21, (byte)0x2C,
|
||||
(byte)0xB5, (byte)0x2A, (byte)0xFF, (byte)0x3C,
|
||||
(byte)0xE1, (byte)0xB1, (byte)0x29, (byte)0x40,
|
||||
(byte)0x18, (byte)0x11, (byte)0x8D, (byte)0x7C,
|
||||
(byte)0x84, (byte)0xA7, (byte)0x0A, (byte)0x72,
|
||||
(byte)0xD6, (byte)0x86, (byte)0xC4, (byte)0x03,
|
||||
(byte)0x19, (byte)0xC8, (byte)0x07, (byte)0x29,
|
||||
(byte)0x7A, (byte)0xCA, (byte)0x95, (byte)0x0C,
|
||||
(byte)0xD9, (byte)0x96, (byte)0x9F, (byte)0xAB,
|
||||
(byte)0xD0, (byte)0x0A, (byte)0x50, (byte)0x9B,
|
||||
(byte)0x02, (byte)0x46, (byte)0xD3, (byte)0x08,
|
||||
(byte)0x3D, (byte)0x66, (byte)0xA4, (byte)0x5D,
|
||||
(byte)0x41, (byte)0x9F, (byte)0x9C, (byte)0x7C,
|
||||
(byte)0xBD, (byte)0x89, (byte)0x4B, (byte)0x22,
|
||||
(byte)0x19, (byte)0x26, (byte)0xBA, (byte)0xAB,
|
||||
(byte)0xA2, (byte)0x5E, (byte)0xC3, (byte)0x55,
|
||||
(byte)0xE9, (byte)0x2F, (byte)0x78, (byte)0xC7
|
||||
};
|
||||
|
||||
// The SKIP 1024 bit modulus
|
||||
private static final BigInteger skip1024Modulus
|
||||
= new BigInteger(1, skip1024ModulusBytes);
|
||||
|
||||
// The base used with the SKIP 1024 bit modulus
|
||||
private static final BigInteger skip1024Base = BigInteger.valueOf(2);
|
||||
}
|
||||
|
||||
@@ -39,43 +39,40 @@ import java.util.Arrays;
|
||||
import javax.crypto.KeyAgreement;
|
||||
import javax.crypto.spec.DHPrivateKeySpec;
|
||||
import javax.crypto.spec.DHPublicKeySpec;
|
||||
import jdk.test.lib.security.DiffieHellmanGroup;
|
||||
import jdk.test.lib.security.SecurityUtils;
|
||||
|
||||
public class TestInterop extends PKCS11Test {
|
||||
|
||||
private final static BigInteger p = new BigInteger
|
||||
("171718397966129586011229151993178480901904202533705695869569760169920539"
|
||||
+ "80807543778874708672297590042574075430109846864794139516459381007417046"
|
||||
+ "27996080624930219892858374168155487210358743785481212360509485282294161"
|
||||
+ "39585571568998066586304075565145536350296006867635076744949977849997684"
|
||||
+ "222020336013226588207303");
|
||||
|
||||
private final static BigInteger g = new BigInteger("2");
|
||||
|
||||
private final static BigInteger ya = new BigInteger
|
||||
("687709211571508809414670982463565909269384277848448625781941269577397703"
|
||||
+ "73675199968849153119146758339814638228795348558483510369322822476757204"
|
||||
+ "22158455966026517829008713407587339322132253724742557954802911059639161"
|
||||
+ "24827916158465757962384625410294483756242900146397201260757102085985457"
|
||||
+ "09397033481077351036224");
|
||||
("22272412859242949963897309866268099957623364986192222381531147912319" +
|
||||
"23153170556019072276127184001075566033823724518300406542189341984" +
|
||||
"14728033901164887842157675409022004721268960808255834930605035809" +
|
||||
"96449867261598768663006346373969582073599358922631400907241847771" +
|
||||
"58539394502794451638884093173505103869438428833148912071609829581" +
|
||||
"89477284513896649100113024962862016311693389603523142235630316916" +
|
||||
"51727812401021776761600004971782662420311224757086651213529674905" +
|
||||
"34921437167341469749945865459714558842881915928697452568830704027" +
|
||||
"08840053484115995358953663434943150292283157101600109003253293611" +
|
||||
"67575903571371898272633920086");
|
||||
|
||||
private final static BigInteger xa = new BigInteger
|
||||
("104917367119952955556289227181599819745346393858545449202252025137706135"
|
||||
+ "98100778613457655440586438263591136003106529323555991109623536177695714"
|
||||
+ "66884181531401472902830508361532232717792847436112280721439936797741371"
|
||||
+ "245140912614191507");
|
||||
("20959988947516815975588968321965141642005944293655257916834342975849");
|
||||
|
||||
private final static BigInteger yb = new BigInteger
|
||||
("163887874871842952463100699681506173424091615364591742415764095471629919"
|
||||
+ "08421025296419917755446931473037086355546823601999684501737493240373415"
|
||||
+ "65608293667837249198973539289354492348897732633852665609611113031379864"
|
||||
+ "58514616034107537409230452318065341748503347627733368519091332060477528"
|
||||
+ "173423377887175351037810");
|
||||
("1788841814501653834923092375117807364896992833810838802030127811094" +
|
||||
"8450381275318704655838368105000403140578033341448162321874634765" +
|
||||
"6870663019881556386613144025875613921737258766185138415793010195" +
|
||||
"3802511267742963370821568963965936108932734114202964873644126233" +
|
||||
"6937947954023458790417933403303562491144788202839815534782475160" +
|
||||
"7813094179390506418017926774832227342290968359943612529948409558" +
|
||||
"4647213355501260440663649115694263879691520265343063263385211121" +
|
||||
"3396751542827391711077192604441343359832896902306354119121777576" +
|
||||
"6479255602858536672821464920683781338851326155035757018336622673" +
|
||||
"39973666608754923308482789421630138499");
|
||||
|
||||
private final static BigInteger xb = new BigInteger
|
||||
("127757517533485947079959908591028646859165238853082197617179368337276371"
|
||||
+ "51601819447716934542027725311863797141734616730248519214531856941516613"
|
||||
+ "30313414180008978013330410484011186019824874948204261839391153650949864"
|
||||
+ "429505597086564709");
|
||||
("37339373137107550077381337769340105015086522284791968753218309293526");
|
||||
|
||||
@Override
|
||||
public void main(Provider prov) throws Exception {
|
||||
@@ -92,13 +89,18 @@ public class TestInterop extends PKCS11Test {
|
||||
KeyAgreement ka = KeyAgreement.getInstance("DH", prov);
|
||||
KeyAgreement kbSunJCE = KeyAgreement.getInstance("DH",
|
||||
System.getProperty("test.provider.name", "SunJCE"));
|
||||
DHPrivateKeySpec privSpecA = new DHPrivateKeySpec(xa, p, g);
|
||||
DHPublicKeySpec pubSpecA = new DHPublicKeySpec(ya, p, g);
|
||||
DiffieHellmanGroup dhGroup = SecurityUtils.getTestDHGroup();
|
||||
DHPrivateKeySpec privSpecA = new DHPrivateKeySpec(xa, dhGroup.getPrime(),
|
||||
dhGroup.getBase());
|
||||
DHPublicKeySpec pubSpecA = new DHPublicKeySpec(ya, dhGroup.getPrime(),
|
||||
dhGroup.getBase());
|
||||
PrivateKey privA = kf.generatePrivate(privSpecA);
|
||||
PublicKey pubA = kf.generatePublic(pubSpecA);
|
||||
|
||||
DHPrivateKeySpec privSpecB = new DHPrivateKeySpec(xb, p, g);
|
||||
DHPublicKeySpec pubSpecB = new DHPublicKeySpec(yb, p, g);
|
||||
DHPrivateKeySpec privSpecB = new DHPrivateKeySpec(xb, dhGroup.getPrime(),
|
||||
dhGroup.getBase());
|
||||
DHPublicKeySpec pubSpecB = new DHPublicKeySpec(yb, dhGroup.getPrime(),
|
||||
dhGroup.getBase());
|
||||
PrivateKey privB = kf.generatePrivate(privSpecB);
|
||||
PublicKey pubB = kf.generatePublic(pubSpecB);
|
||||
|
||||
@@ -110,6 +112,10 @@ public class TestInterop extends PKCS11Test {
|
||||
kbSunJCE.doPhase(pubA, true);
|
||||
byte[] n2 = kbSunJCE.generateSecret();
|
||||
|
||||
// verify that a leading zero is present in secrets
|
||||
if (n1[0] != 0 || n2[0] != 0) {
|
||||
throw new Exception("First byte is not zero as expected");
|
||||
}
|
||||
if (Arrays.equals(n1, n2) == false) {
|
||||
throw new Exception("values mismatch!");
|
||||
} else {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -35,45 +35,61 @@ public class Verify {
|
||||
|
||||
static String selfSignedCertStr =
|
||||
"-----BEGIN CERTIFICATE-----\n" +
|
||||
"MIICPjCCAaegAwIBAgIBADANBgkqhkiG9w0BAQQFADAfMQswCQYDVQQGEwJVUzEQ\n" +
|
||||
"MA4GA1UEChMHRXhhbXBsZTAeFw0wOTA0MjcwMjI0MzJaFw0zMDA0MDcwMjI0MzJa\n" +
|
||||
"MB8xCzAJBgNVBAYTAlVTMRAwDgYDVQQKEwdFeGFtcGxlMIGfMA0GCSqGSIb3DQEB\n" +
|
||||
"AQUAA4GNADCBiQKBgQC4OTag24sTxL2tXTNuvpmUEtdxrYAZoFsslFQ60T+WD9wQ\n" +
|
||||
"Jeiw87FSPsR2vxRuv0j8DNm2a4h7LNNIFcLurfNldbz5pvgZ7VqdbbUMPE9qP85n\n" +
|
||||
"jgDl4woyRTSUeRI4A7O0CO6NpES21dtbdhroWQrEkHxpnrDPxsxrz5gf2m3gqwID\n" +
|
||||
"AQABo4GJMIGGMB0GA1UdDgQWBBSCJd0hpl5PdAD9IZS+Hzng4lXLGzBHBgNVHSME\n" +
|
||||
"QDA+gBSCJd0hpl5PdAD9IZS+Hzng4lXLG6EjpCEwHzELMAkGA1UEBhMCVVMxEDAO\n" +
|
||||
"BgNVBAoTB0V4YW1wbGWCAQAwDwYDVR0TAQH/BAUwAwEB/zALBgNVHQ8EBAMCAgQw\n" +
|
||||
"DQYJKoZIhvcNAQEEBQADgYEAluy6HIjWcq009lTLmhp+Np6dxU78pInBK8RZkza0\n" +
|
||||
"484qGaxFGD3UGyZkI5uWmsH2XuMbuox5khfIq6781gmkPBHXBIEtJN8eLusOHEye\n" +
|
||||
"iE8h7WI+N3qa6Pj56WionMrioqC/3X+b06o147bbhx8U0vkYv/HyPaITOFfMXTdz\n" +
|
||||
"Vjw=\n" +
|
||||
"MIIDVzCCAj+gAwIBAgIUUM/RKxE2Rcc6zYLWLxNolpLnuiwwDQYJKoZIhvcNAQEL\n" +
|
||||
"BQAwOzENMAsGA1UEAwwEUk9PVDEQMA4GA1UECgwHRXhhbXBsZTELMAkGA1UECAwC\n" +
|
||||
"Q0ExCzAJBgNVBAYTAlVTMB4XDTI0MDYxOTA0NDc1N1oXDTM0MDYxOTA0NDc1N1ow\n" +
|
||||
"OzENMAsGA1UEAwwEUk9PVDEQMA4GA1UECgwHRXhhbXBsZTELMAkGA1UECAwCQ0Ex\n" +
|
||||
"CzAJBgNVBAYTAlVTMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAohRG\n" +
|
||||
"eq8/CniUqWEtpm1gBp+PWENpYgeaALAUgFdBBa6ao7mESjxRG8teaNRcszmoL3Rl\n" +
|
||||
"TH5hLycHA00G5qsALXo4Cj9wAGfR3LbA0HlTurdw3NNk76twQXZpuE19YNYQonbR\n" +
|
||||
"Mm2sgTd2YcrNWmGpthgNiUaT837Yt7RCuurPo4zi1y6g/NJwyLtn775S86NrV5PT\n" +
|
||||
"4vaBCsB5+eCm01CBgzBq3I0OY5oosopNUjmFL4LYccZZ2YAOUY0fvxfsMZD5EDcj\n" +
|
||||
"KrgKBspjmolfn5g5lA5vdVthG2/TxTIdLss69+NsGS1RBkSKGiQNKnRnAB9/gHwc\n" +
|
||||
"2ryHKJRMQrV+JGMjrQIDAQABo1MwUTAdBgNVHQ4EFgQUW6jZ+mcCEMAQTUzJH2F0\n" +
|
||||
"TwMTOMswHwYDVR0jBBgwFoAUW6jZ+mcCEMAQTUzJH2F0TwMTOMswDwYDVR0TAQH/\n" +
|
||||
"BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAB8T/EfVh602S1GJD2tJ1ck9TwutF\n" +
|
||||
"2VSoSRKajMOabbwjzKEAeJ9rNcWiy60rSvDuL8i4IL52R7fHhlJaDg9FVjmkiWSO\n" +
|
||||
"VPiIZuOyvUtsc9++AM741RK9OrEMETvAtbtEMU6du7LiFk2KcnDTHfcNihtM/TNZ\n" +
|
||||
"1bzEKuSfQydBNPkO3Ftmveygj7QGX+Kgppp7RXXUFzySYxrlA1usgNhVXY/qhFiJ\n" +
|
||||
"jhTU33iZgwiKxpY+zj/Gmk5sdOCEk7e1P06IB3eIopdRTMGJCeCBKyFyXND38kNC\n" +
|
||||
"bTIPnuOdE73M2AW0LWuPv6UQZVBv5A82WMT9f8Hq9H2cHbuhgL/ozyFSWw==\n" +
|
||||
"-----END CERTIFICATE-----";
|
||||
|
||||
static String crlIssuerCertStr =
|
||||
"-----BEGIN CERTIFICATE-----\n" +
|
||||
"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\n" +
|
||||
"w8Xo1Fv3aNOygWdXdVDL79jkOJo2wO8yIe+J6Ig=\n" +
|
||||
"-----END CERTIFICATE-----";
|
||||
|
||||
static String crlStr =
|
||||
"-----BEGIN X509 CRL-----\n" +
|
||||
"MIIBGzCBhQIBATANBgkqhkiG9w0BAQQFADAfMQswCQYDVQQGEwJVUzEQMA4GA1UE\n" +
|
||||
"ChMHRXhhbXBsZRcNMDkwNDI3MDIzODA0WhcNMjgwNjI2MDIzODA0WjAiMCACAQUX\n" +
|
||||
"DTA5MDQyNzAyMzgwMFowDDAKBgNVHRUEAwoBBKAOMAwwCgYDVR0UBAMCAQIwDQYJ\n" +
|
||||
"KoZIhvcNAQEEBQADgYEAoarfzXEtw3ZDi4f9U8eSvRIipHSyxOrJC7HR/hM5VhmY\n" +
|
||||
"CErChny6x9lBVg9s57tfD/P9PSzBLusCcHwHMAbMOEcTltVVKUWZnnbumpywlYyg\n" +
|
||||
"oKLrE9+yCOkYUOpiRlz43/3vkEL5hjIKMcDSZnPKBZi1h16Yj2hPe9GMibNip54=\n" +
|
||||
"MIIBtjCBnwIBATANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQDDAJDQTELMAkGA1UE\n" +
|
||||
"CAwCQ0ExCzAJBgNVBAYTAlVTMRAwDgYDVQQKDAdFeGFtcGxlFw0yNDA2MTkwNDQ3\n" +
|
||||
"NThaFw0yNjA2MTgwNDQ3NThaMCIwIAIBAhcNMjQwNjE5MDQ0NzU4WjAMMAoGA1Ud\n" +
|
||||
"FQQDCgEEoA4wDDAKBgNVHRQEAwIBATANBgkqhkiG9w0BAQUFAAOCAQEAkN0owWtq\n" +
|
||||
"We0SznF9rAAADLMfB/2GKBQpqsJXXwE9FnCm8emSDtHpud+NZL+PAy9g050et8nl\n" +
|
||||
"CNey/FBMJJMN3b3SZKkHA2MR4qJmHfeFnlE5mHnUHg7gH0a1u7H7wf0Z/L6eZNWy\n" +
|
||||
"dB905II7Ej0GBuPnLsKNMDBtGtDuSPXCvmaBsKDe8awaEA1VchZKVLzg+8hEC0vt\n" +
|
||||
"60jz9HrDpFun99IKTTCxBT+9GrW38GbPMxj0rLAL4n75SrfPdeFPj0t5fksOC7a7\n" +
|
||||
"SLO9t+UC89SMTsoIwVjHIFIUxw5FHpuUfgOQ7PtjhpLd2Pm5u5Pe2gv4Q41xVgVW\n" +
|
||||
"hVMagRPmAQAniQ==\n" +
|
||||
"-----END X509 CRL-----";
|
||||
|
||||
private static X509CRL crl;
|
||||
@@ -104,7 +120,7 @@ public class Verify {
|
||||
|
||||
/*
|
||||
* Try to verify CRL with a provider that has a Signature implementation
|
||||
* but not of the right algorithm (MD5withRSA).
|
||||
* but not of the right algorithm (SHA1withRSA).
|
||||
* Should fail with NoSuchAlgorithmException.
|
||||
*/
|
||||
try {
|
||||
|
||||
@@ -36,35 +36,47 @@ public class Verify {
|
||||
|
||||
static String selfSignedCertStr =
|
||||
"-----BEGIN CERTIFICATE-----\n" +
|
||||
"MIICPjCCAaegAwIBAgIBADANBgkqhkiG9w0BAQQFADAfMQswCQYDVQQGEwJVUzEQ\n" +
|
||||
"MA4GA1UEChMHRXhhbXBsZTAeFw0wOTA0MjcwMjI0MzJaFw0zMDA0MDcwMjI0MzJa\n" +
|
||||
"MB8xCzAJBgNVBAYTAlVTMRAwDgYDVQQKEwdFeGFtcGxlMIGfMA0GCSqGSIb3DQEB\n" +
|
||||
"AQUAA4GNADCBiQKBgQC4OTag24sTxL2tXTNuvpmUEtdxrYAZoFsslFQ60T+WD9wQ\n" +
|
||||
"Jeiw87FSPsR2vxRuv0j8DNm2a4h7LNNIFcLurfNldbz5pvgZ7VqdbbUMPE9qP85n\n" +
|
||||
"jgDl4woyRTSUeRI4A7O0CO6NpES21dtbdhroWQrEkHxpnrDPxsxrz5gf2m3gqwID\n" +
|
||||
"AQABo4GJMIGGMB0GA1UdDgQWBBSCJd0hpl5PdAD9IZS+Hzng4lXLGzBHBgNVHSME\n" +
|
||||
"QDA+gBSCJd0hpl5PdAD9IZS+Hzng4lXLG6EjpCEwHzELMAkGA1UEBhMCVVMxEDAO\n" +
|
||||
"BgNVBAoTB0V4YW1wbGWCAQAwDwYDVR0TAQH/BAUwAwEB/zALBgNVHQ8EBAMCAgQw\n" +
|
||||
"DQYJKoZIhvcNAQEEBQADgYEAluy6HIjWcq009lTLmhp+Np6dxU78pInBK8RZkza0\n" +
|
||||
"484qGaxFGD3UGyZkI5uWmsH2XuMbuox5khfIq6781gmkPBHXBIEtJN8eLusOHEye\n" +
|
||||
"iE8h7WI+N3qa6Pj56WionMrioqC/3X+b06o147bbhx8U0vkYv/HyPaITOFfMXTdz\n" +
|
||||
"Vjw=\n" +
|
||||
"MIIDVzCCAj+gAwIBAgIUUM/RKxE2Rcc6zYLWLxNolpLnuiwwDQYJKoZIhvcNAQEL\n" +
|
||||
"BQAwOzENMAsGA1UEAwwEUk9PVDEQMA4GA1UECgwHRXhhbXBsZTELMAkGA1UECAwC\n" +
|
||||
"Q0ExCzAJBgNVBAYTAlVTMB4XDTI0MDYxOTA0NDc1N1oXDTM0MDYxOTA0NDc1N1ow\n" +
|
||||
"OzENMAsGA1UEAwwEUk9PVDEQMA4GA1UECgwHRXhhbXBsZTELMAkGA1UECAwCQ0Ex\n" +
|
||||
"CzAJBgNVBAYTAlVTMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAohRG\n" +
|
||||
"eq8/CniUqWEtpm1gBp+PWENpYgeaALAUgFdBBa6ao7mESjxRG8teaNRcszmoL3Rl\n" +
|
||||
"TH5hLycHA00G5qsALXo4Cj9wAGfR3LbA0HlTurdw3NNk76twQXZpuE19YNYQonbR\n" +
|
||||
"Mm2sgTd2YcrNWmGpthgNiUaT837Yt7RCuurPo4zi1y6g/NJwyLtn775S86NrV5PT\n" +
|
||||
"4vaBCsB5+eCm01CBgzBq3I0OY5oosopNUjmFL4LYccZZ2YAOUY0fvxfsMZD5EDcj\n" +
|
||||
"KrgKBspjmolfn5g5lA5vdVthG2/TxTIdLss69+NsGS1RBkSKGiQNKnRnAB9/gHwc\n" +
|
||||
"2ryHKJRMQrV+JGMjrQIDAQABo1MwUTAdBgNVHQ4EFgQUW6jZ+mcCEMAQTUzJH2F0\n" +
|
||||
"TwMTOMswHwYDVR0jBBgwFoAUW6jZ+mcCEMAQTUzJH2F0TwMTOMswDwYDVR0TAQH/\n" +
|
||||
"BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAB8T/EfVh602S1GJD2tJ1ck9TwutF\n" +
|
||||
"2VSoSRKajMOabbwjzKEAeJ9rNcWiy60rSvDuL8i4IL52R7fHhlJaDg9FVjmkiWSO\n" +
|
||||
"VPiIZuOyvUtsc9++AM741RK9OrEMETvAtbtEMU6du7LiFk2KcnDTHfcNihtM/TNZ\n" +
|
||||
"1bzEKuSfQydBNPkO3Ftmveygj7QGX+Kgppp7RXXUFzySYxrlA1usgNhVXY/qhFiJ\n" +
|
||||
"jhTU33iZgwiKxpY+zj/Gmk5sdOCEk7e1P06IB3eIopdRTMGJCeCBKyFyXND38kNC\n" +
|
||||
"bTIPnuOdE73M2AW0LWuPv6UQZVBv5A82WMT9f8Hq9H2cHbuhgL/ozyFSWw==\n" +
|
||||
"-----END CERTIFICATE-----";
|
||||
|
||||
static String crlIssuerCertStr =
|
||||
"-----BEGIN CERTIFICATE-----\n" +
|
||||
"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\n" +
|
||||
"w8Xo1Fv3aNOygWdXdVDL79jkOJo2wO8yIe+J6Ig=\n" +
|
||||
"-----END CERTIFICATE-----";
|
||||
|
||||
private static X509Certificate cert;
|
||||
@@ -96,7 +108,7 @@ public class Verify {
|
||||
|
||||
/*
|
||||
* Try to verify certificate with a provider that has a Signature
|
||||
* implementation but not of the right algorithm (MD5withRSA).
|
||||
* implementation but not of the right algorithm (SHA1withRSA).
|
||||
* Should fail with NoSuchAlgorithmException.
|
||||
*/
|
||||
try {
|
||||
|
||||
109
test/lib/jdk/test/lib/security/DiffieHellmanGroup.java
Normal file
109
test/lib/jdk/test/lib/security/DiffieHellmanGroup.java
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package jdk.test.lib.security;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
/**
|
||||
* An enumeration of DH groups for tests.
|
||||
*/
|
||||
public enum DiffieHellmanGroup {
|
||||
|
||||
/**
|
||||
* RFC 7919 - ffdhe2048.
|
||||
*/
|
||||
ffdhe2048(new BigInteger("FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1" +
|
||||
"D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" +
|
||||
"7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561" +
|
||||
"2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" +
|
||||
"984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735" +
|
||||
"30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" +
|
||||
"B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19" +
|
||||
"0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" +
|
||||
"9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73" +
|
||||
"3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" +
|
||||
"886B423861285C97FFFFFFFFFFFFFFFF", 16), 2),
|
||||
/**
|
||||
* RFC 7919 - ffdhe3072.
|
||||
*/
|
||||
ffdhe3072(new BigInteger("FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1" +
|
||||
"D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" +
|
||||
"7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561" +
|
||||
"2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" +
|
||||
"984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735" +
|
||||
"30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" +
|
||||
"B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19" +
|
||||
"0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" +
|
||||
"9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73" +
|
||||
"3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" +
|
||||
"886B4238611FCFDCDE355B3B6519035BBC34F4DEF99C0238" +
|
||||
"61B46FC9D6E6C9077AD91D2691F7F7EE598CB0FAC186D91C" +
|
||||
"AEFE130985139270B4130C93BC437944F4FD4452E2D74DD3" +
|
||||
"64F2E21E71F54BFF5CAE82AB9C9DF69EE86D2BC522363A0D" +
|
||||
"ABC521979B0DEADA1DBF9A42D5C4484E0ABCD06BFA53DDEF" +
|
||||
"3C1B20EE3FD59D7C25E41D2B66C62E37FFFFFFFFFFFFFFFF", 16), 2),
|
||||
/**
|
||||
* RFC 7919 - ffdhe4096.
|
||||
*/
|
||||
ffdhe4096(new BigInteger("FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1" +
|
||||
"D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" +
|
||||
"7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561" +
|
||||
"2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" +
|
||||
"984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735" +
|
||||
"30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" +
|
||||
"B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19" +
|
||||
"0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" +
|
||||
"9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73" +
|
||||
"3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" +
|
||||
"886B4238611FCFDCDE355B3B6519035BBC34F4DEF99C0238" +
|
||||
"61B46FC9D6E6C9077AD91D2691F7F7EE598CB0FAC186D91C" +
|
||||
"AEFE130985139270B4130C93BC437944F4FD4452E2D74DD3" +
|
||||
"64F2E21E71F54BFF5CAE82AB9C9DF69EE86D2BC522363A0D" +
|
||||
"ABC521979B0DEADA1DBF9A42D5C4484E0ABCD06BFA53DDEF" +
|
||||
"3C1B20EE3FD59D7C25E41D2B669E1EF16E6F52C3164DF4FB" +
|
||||
"7930E9E4E58857B6AC7D5F42D69F6D187763CF1D55034004" +
|
||||
"87F55BA57E31CC7A7135C886EFB4318AED6A1E012D9E6832" +
|
||||
"A907600A918130C46DC778F971AD0038092999A333CB8B7A" +
|
||||
"1A1DB93D7140003C2A4ECEA9F98D0ACC0A8291CDCEC97DCF" +
|
||||
"8EC9B55A7F88A46B4DB5A851F44182E1C68A007E5E655F6A" +
|
||||
"FFFFFFFFFFFFFFFF", 16), 2);
|
||||
|
||||
|
||||
public BigInteger getPrime() {
|
||||
return prime;
|
||||
}
|
||||
|
||||
private final BigInteger prime;
|
||||
|
||||
public BigInteger getBase() {
|
||||
return base;
|
||||
}
|
||||
|
||||
private final BigInteger base;
|
||||
|
||||
DiffieHellmanGroup(BigInteger prime, int base) {
|
||||
this.prime = prime;
|
||||
this.base = BigInteger.valueOf(base);
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import jdk.test.lib.security.DiffieHellmanGroup;
|
||||
|
||||
/**
|
||||
* Common library for various security test helper functions.
|
||||
@@ -147,6 +148,25 @@ public final class SecurityUtils {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a DH predefined group for tests
|
||||
*/
|
||||
public static DiffieHellmanGroup getTestDHGroup() {
|
||||
return getTestDHGroup(2048);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a DH predefined group for tests, depending on the specified prime size
|
||||
*/
|
||||
public static DiffieHellmanGroup getTestDHGroup(int primeSize) {
|
||||
return switch(primeSize) {
|
||||
case 2048 -> DiffieHellmanGroup.ffdhe2048;
|
||||
case 3072 -> DiffieHellmanGroup.ffdhe3072;
|
||||
case 4096 -> DiffieHellmanGroup.ffdhe4096;
|
||||
default -> throw new RuntimeException("Test DH group not defined for " + primeSize);
|
||||
};
|
||||
}
|
||||
|
||||
private static void removeFromDSigPolicy(String rule, List<String> algs) {
|
||||
String value = Security.getProperty("jdk.xml.dsig.secureValidationPolicy");
|
||||
value = Arrays.stream(value.split(","))
|
||||
|
||||
Reference in New Issue
Block a user