test/jdk/sun/security/pkcs11/ec/TestECDSA2.java
author jjiang
Wed, 15 Aug 2018 18:41:18 +0800
changeset 51460 97e361fe3433
parent 51245 f095e3bc2d41
permissions -rw-r--r--
8164639: Configure PKCS11 tests to use user-supplied NSS libraries Summary: Provide system property "test.nss.lib.paths" for specifying a set of absolute paths to the custom NSS lib directories Reviewed-by: weijun, rhalade
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13672
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
     1
/*
51245
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
     2
 * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
13672
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
     4
 *
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
     7
 * published by the Free Software Foundation.
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
     8
 *
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    13
 * accompanied this code).
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    14
 *
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    18
 *
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    21
 * questions.
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    22
 */
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    23
40975
680639c9b307 8165689: Fix module dependencies for sun/security/pkcs11/* tests
skovalev
parents: 35379
diff changeset
    24
/*
13672
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    25
 * @test
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    26
 * @bug 6405536
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    27
 * @summary basic test of ECDSA signatures for P-256 and P-384 from the
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    28
 * example data in "Suite B Implementer's Guide to FIPS 186-3".
51460
97e361fe3433 8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents: 51245
diff changeset
    29
 * @library /test/lib ..
13672
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    30
 * @library ../../../../java/security/testlibrary
30820
0d4717a011d3 8081347: Add @modules to jdk_core tests
mchung
parents: 19067
diff changeset
    31
 * @modules java.base/sun.security.util
43248
5e15de85a1a0 8172527: Rename jdk.crypto.token to jdk.crypto.cryptoki
ascarpino
parents: 42693
diff changeset
    32
 *          jdk.crypto.cryptoki
13672
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    33
 * @compile -XDignore.symbol.file TestECDSA2.java
35379
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
    34
 * @run main/othervm TestECDSA2
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
    35
 * @run main/othervm TestECDSA2 sm
13672
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    36
 */
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    37
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    38
import java.math.BigInteger;
35379
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
    39
import java.security.AlgorithmParameters;
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
    40
import java.security.KeyFactory;
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
    41
import java.security.KeyPair;
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
    42
import java.security.PrivateKey;
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
    43
import java.security.Provider;
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
    44
import java.security.PublicKey;
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
    45
import java.security.Signature;
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
    46
import java.security.spec.ECGenParameterSpec;
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
    47
import java.security.spec.ECParameterSpec;
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
    48
import java.security.spec.ECPoint;
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
    49
import java.security.spec.ECPrivateKeySpec;
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
    50
import java.security.spec.ECPublicKeySpec;
13672
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    51
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    52
public class TestECDSA2 extends PKCS11Test {
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    53
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    54
    // values of the keys we use for the tests
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    55
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    56
    // keypair using NIST P-256
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    57
    private final static String privD256 = "70a12c2db16845ed56ff68cfc21a472b3f04d7d6851bf6349f2d7d5b3452b38a";
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    58
    private final static String pubX256 = "8101ece47464a6ead70cf69a6e2bd3d88691a3262d22cba4f7635eaff26680a8";
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    59
    private final static String pubY256 = "d8a12ba61d599235f67d9cb4d58f1783d3ca43e78f0a5abaa624079936c0c3a9";
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    60
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    61
    // keypair using NIST P-384
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    62
    private final static String privD384 = "c838b85253ef8dc7394fa5808a5183981c7deef5a69ba8f4f2117ffea39cfcd90e95f6cbc854abacab701d50c1f3cf24";
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    63
    private final static String pubX384 = "1fbac8eebd0cbf35640b39efe0808dd774debff20a2a329e91713baf7d7f3c3e81546d883730bee7e48678f857b02ca0";
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    64
    private final static String pubY384 = "eb213103bd68ce343365a8a4c3d4555fa385f5330203bdd76ffad1f3affb95751c132007e1b240353cb0a4cf1693bdf9";
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    65
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    66
    // data to be signed
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    67
    private final static byte[] data = "This is only a test message. It is 48 bytes long".getBytes();
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    68
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    69
    private KeyFactory kf = null;
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    70
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    71
    private static void testSignAndVerify(String alg, KeyPair kp, Provider p) throws Exception {
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    72
        Signature s = Signature.getInstance(alg, p);
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    73
        s.initSign(kp.getPrivate());
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    74
        s.update(data);
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    75
        byte[] result = s.sign();
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    76
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    77
        s.initVerify(kp.getPublic());
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    78
        s.update(data);
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    79
        if (!s.verify(result)) {
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    80
            throw new Exception("Error: Signature verification failed");
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    81
        }
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    82
        System.out.println(p.getName() + ": " + alg + " Passed");
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    83
    }
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    84
17491
7a33824ec8c5 7194075: Various classes of sunec.jar are duplicated in rt.jar
vinnie
parents: 13672
diff changeset
    85
    private KeyPair genECKeyPair(String curvName, String privD, String pubX,
7a33824ec8c5 7194075: Various classes of sunec.jar are duplicated in rt.jar
vinnie
parents: 13672
diff changeset
    86
            String pubY, Provider p) throws Exception {
35379
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
    87
        AlgorithmParameters params = AlgorithmParameters.getInstance("EC", p);
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
    88
        params.init(new ECGenParameterSpec(curvName));
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
    89
        ECParameterSpec ecParams = params.getParameterSpec(ECParameterSpec.class);
13672
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    90
        ECPrivateKeySpec privKeySpec =
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    91
            new ECPrivateKeySpec(new BigInteger(privD, 16), ecParams);
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    92
        ECPublicKeySpec pubKeySpec =
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    93
            new ECPublicKeySpec(new ECPoint(new BigInteger(pubX, 16), new BigInteger(pubY, 16)),
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    94
                                ecParams);
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    95
        PrivateKey privKey = kf.generatePrivate(privKeySpec);
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    96
        PublicKey pubKey = kf.generatePublic(pubKeySpec);
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    97
        return new KeyPair(pubKey, privKey);
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    98
    }
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
    99
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   100
    public static void main(String[] args) throws Exception {
35379
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
   101
        main(new TestECDSA2(), args);
13672
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   102
    }
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   103
35379
1e8e336ef66b 8144539: Update PKCS11 tests to run with security manager
asmotrak
parents: 30820
diff changeset
   104
    @Override
51245
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   105
    protected boolean skipTest(Provider provider) {
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   106
        boolean testP256 =
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   107
                provider.getService("Signature", "SHA256withECDSA") != null;
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   108
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   109
        boolean testP384 =
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   110
                provider.getService("Signature", "SHA384withECDSA") != null;
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   111
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   112
        if (!testP256 && !testP384) {
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   113
            System.out.println("ECDSA not supported, skipping");
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   114
            return true;
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   115
        }
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   116
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   117
        if (isBadNSSVersion(provider)) {
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   118
            return true;
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   119
        }
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   120
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   121
        return false;
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   122
    }
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   123
f095e3bc2d41 8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents: 47216
diff changeset
   124
    @Override
13672
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   125
    public void main(Provider provider) throws Exception {
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   126
        boolean testP256 =
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   127
            (provider.getService("Signature", "SHA256withECDSA") != null);
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   128
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   129
        boolean testP384 =
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   130
            (provider.getService("Signature", "SHA384withECDSA") != null);
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   131
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   132
        kf = KeyFactory.getInstance("EC", provider);
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   133
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   134
        long start = System.currentTimeMillis();
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   135
        if (testP256) {
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   136
            // can use secp256r1, NIST P-256, X9.62 prime256v1, or 1.2.840.10045.3.1.7
17491
7a33824ec8c5 7194075: Various classes of sunec.jar are duplicated in rt.jar
vinnie
parents: 13672
diff changeset
   137
            KeyPair kp =
7a33824ec8c5 7194075: Various classes of sunec.jar are duplicated in rt.jar
vinnie
parents: 13672
diff changeset
   138
                genECKeyPair("secp256r1", privD256, pubX256, pubY256, provider);
13672
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   139
            testSignAndVerify("SHA256withECDSA", kp, provider);
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   140
        }
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   141
        if (testP384) {
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   142
            // can use secp384r1, NIST P-384, 1.3.132.0.34
17491
7a33824ec8c5 7194075: Various classes of sunec.jar are duplicated in rt.jar
vinnie
parents: 13672
diff changeset
   143
            KeyPair kp =
7a33824ec8c5 7194075: Various classes of sunec.jar are duplicated in rt.jar
vinnie
parents: 13672
diff changeset
   144
                genECKeyPair("secp384r1", privD384, pubX384, pubY384, provider);
13672
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   145
            testSignAndVerify("SHA384withECDSA", kp, provider);
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   146
        }
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   147
        long stop = System.currentTimeMillis();
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   148
        System.out.println("All tests passed (" + (stop - start) + " ms).");
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   149
    }
604588823b5a 7044060: Need to support NSA Suite B Cryptography algorithms
valeriep
parents:
diff changeset
   150
}