author | apetcher |
Thu, 21 Mar 2019 13:10:37 -0400 | |
changeset 54215 | b00a4187d5ec |
parent 54197 | ddfb658c8ce3 |
permissions | -rw-r--r-- |
54197
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
1 |
/* |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
2 |
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
4 |
* |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
8 |
* |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
13 |
* accompanied this code). |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
14 |
* |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
18 |
* |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
21 |
* questions. |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
22 |
*/ |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
23 |
|
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
24 |
import jdk.test.lib.Convert; |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
25 |
|
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
26 |
import java.security.*; |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
27 |
import java.security.spec.*; |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
28 |
import java.math.*; |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
29 |
import java.util.*; |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
30 |
|
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
31 |
/* |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
32 |
* @test |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
33 |
* @bug 8147502 |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
34 |
* @summary Test that digests are properly truncated before the signature |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
35 |
* is applied. The digest should be truncated to the bit length of the |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
36 |
* group order. |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
37 |
* @library /test/lib |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
38 |
* @build jdk.test.lib.Convert |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
39 |
* @run main SignatureDigestTruncate |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
40 |
*/ |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
41 |
public class SignatureDigestTruncate { |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
42 |
|
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
43 |
/* |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
44 |
* A SecureRandom that produces nextBytes in a way that causes the nonce |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
45 |
* to be set to the value supplied to the constructor. This class |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
46 |
* is specific to the way that the native ECDSA implementation in |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
47 |
* SunEC produces nonces from random input. It may not work for all |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
48 |
* test cases, and it will need to be updated when the behavior of |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
49 |
* SunEC changes. |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
50 |
*/ |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
51 |
private static class FixedRandom extends SecureRandom { |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
52 |
|
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
53 |
private final byte[] val; |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
54 |
|
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
55 |
public FixedRandom(byte[] val) { |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
56 |
// SunEC adds one to the value returned, so subtract one here in |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
57 |
// order to get back to the correct value. |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
58 |
BigInteger biVal = new BigInteger(1, val); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
59 |
biVal = biVal.subtract(BigInteger.ONE); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
60 |
byte[] temp = biVal.toByteArray(); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
61 |
this.val = new byte[val.length]; |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
62 |
int inStartPos = Math.max(0, temp.length - val.length); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
63 |
int outStartPos = Math.max(0, val.length - temp.length); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
64 |
System.arraycopy(temp, inStartPos, this.val, outStartPos, |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
65 |
temp.length - inStartPos); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
66 |
} |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
67 |
|
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
68 |
@Override |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
69 |
public void nextBytes(byte[] bytes) { |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
70 |
// SunEC samples (n + 1) * 2 bytes, but only n*2 bytes are used by |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
71 |
// the native implementation. So the value must be offset slightly. |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
72 |
Arrays.fill(bytes, (byte) 0); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
73 |
int copyLength = Math.min(val.length, bytes.length - 2); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
74 |
System.arraycopy(val, 0, bytes, bytes.length - copyLength - 2, |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
75 |
copyLength); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
76 |
} |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
77 |
} |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
78 |
|
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
79 |
private static void assertEquals(byte[] expected, byte[] actual, |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
80 |
String name) { |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
81 |
if (!Arrays.equals(actual, expected)) { |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
82 |
System.out.println("expect: " |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
83 |
+ Convert.byteArrayToHexString(expected)); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
84 |
System.out.println("actual: " |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
85 |
+ Convert.byteArrayToHexString(actual)); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
86 |
throw new RuntimeException("Incorrect " + name + " value"); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
87 |
} |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
88 |
} |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
89 |
|
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
90 |
private static void runTest(String alg, String curveName, |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
91 |
String privateKeyStr, String msgStr, String kStr, String sigStr) |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
92 |
throws Exception { |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
93 |
|
54215
b00a4187d5ec
8221172: SunEC specific test is not limited to SunEC
apetcher
parents:
54197
diff
changeset
|
94 |
System.out.println("Testing " + alg + " with " + curveName); |
b00a4187d5ec
8221172: SunEC specific test is not limited to SunEC
apetcher
parents:
54197
diff
changeset
|
95 |
|
54197
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
96 |
byte[] privateKey = Convert.hexStringToByteArray(privateKeyStr); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
97 |
byte[] msg = Convert.hexStringToByteArray(msgStr); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
98 |
byte[] k = Convert.hexStringToByteArray(kStr); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
99 |
byte[] expectedSig = Convert.hexStringToByteArray(sigStr); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
100 |
|
54215
b00a4187d5ec
8221172: SunEC specific test is not limited to SunEC
apetcher
parents:
54197
diff
changeset
|
101 |
AlgorithmParameters params = |
b00a4187d5ec
8221172: SunEC specific test is not limited to SunEC
apetcher
parents:
54197
diff
changeset
|
102 |
AlgorithmParameters.getInstance("EC", "SunEC"); |
54197
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
103 |
params.init(new ECGenParameterSpec(curveName)); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
104 |
ECParameterSpec ecParams = |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
105 |
params.getParameterSpec(ECParameterSpec.class); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
106 |
|
54215
b00a4187d5ec
8221172: SunEC specific test is not limited to SunEC
apetcher
parents:
54197
diff
changeset
|
107 |
KeyFactory kf = KeyFactory.getInstance("EC", "SunEC"); |
54197
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
108 |
BigInteger s = new BigInteger(1, privateKey); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
109 |
ECPrivateKeySpec privKeySpec = new ECPrivateKeySpec(s, ecParams); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
110 |
PrivateKey privKey = kf.generatePrivate(privKeySpec); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
111 |
|
54215
b00a4187d5ec
8221172: SunEC specific test is not limited to SunEC
apetcher
parents:
54197
diff
changeset
|
112 |
Signature sig = Signature.getInstance(alg, "SunEC"); |
54197
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
113 |
sig.initSign(privKey, new FixedRandom(k)); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
114 |
sig.update(msg); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
115 |
byte[] computedSig = sig.sign(); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
116 |
assertEquals(expectedSig, computedSig, "signature"); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
117 |
} |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
118 |
|
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
119 |
public static void main(String[] args) throws Exception { |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
120 |
runTest("SHA384withECDSAinP1363Format", "sect283r1", |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
121 |
"abcdef10234567", "010203040506070809", |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
122 |
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d" + |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
123 |
"1e1f20212223", |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
124 |
"01d7544b5d3935216bd45e2f8042537e1e0296a11e0eb96666199281b409" + |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
125 |
"42abccd5358a035de8a314d3e6c2a97614daebf5fb1313540eec3f9a3272" + |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
126 |
"068aa10922ccae87d255c84c"); |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
127 |
} |
ddfb658c8ce3
8147502: Digest is incorrectly truncated for ECDSA signatures when the bit length of n is less than the field size
apetcher
parents:
diff
changeset
|
128 |
} |