src/jdk.crypto.ec/share/classes/sun/security/ec/ECPrivateKeyImpl.java
author apetcher
Tue, 11 Dec 2018 09:42:45 -0500
changeset 52946 752e57845ad2
parent 47216 71c04702a3d5
permissions -rw-r--r--
8208698: Improved ECC Implementation Summary: New implementation of ECDH and ECDSA forsome prime-order curves Reviewed-by: ascarpino
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
52946
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
     2
 * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.security.ec;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.math.BigInteger;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.security.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.security.interfaces.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.security.spec.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
52946
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
    35
import sun.security.util.*;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import sun.security.x509.AlgorithmId;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import sun.security.pkcs.PKCS8Key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * Key implementation for EC private keys.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * ASN.1 syntax for EC private keys from SEC 1 v1.5 (draft):
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * EXPLICIT TAGS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * ECPrivateKey ::= SEQUENCE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *   version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *   privateKey OCTET STRING,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *   parameters [0] ECDomainParameters {{ SECGCurveNames }} OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *   publicKey [1] BIT STRING OPTIONAL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * We currently ignore the optional parameters and publicKey fields. We
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * require that the parameters are encoded as part of the AlgorithmIdentifier,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * not in the private key structure.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * @since   1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * @author  Andreas Sterbenz
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
public final class ECPrivateKeyImpl extends PKCS8Key implements ECPrivateKey {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    private static final long serialVersionUID = 88695385615075129L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    private BigInteger s;       // private value
52946
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
    67
    private byte[] arrayS;      // private value as a little-endian array
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    private ECParameterSpec params;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    /**
17491
7a33824ec8c5 7194075: Various classes of sunec.jar are duplicated in rt.jar
vinnie
parents: 5506
diff changeset
    71
     * Construct a key from its encoding. Called by the ECKeyFactory.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     */
17491
7a33824ec8c5 7194075: Various classes of sunec.jar are duplicated in rt.jar
vinnie
parents: 5506
diff changeset
    73
    ECPrivateKeyImpl(byte[] encoded) throws InvalidKeyException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        decode(encoded);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * Construct a key from its components. Used by the
17491
7a33824ec8c5 7194075: Various classes of sunec.jar are duplicated in rt.jar
vinnie
parents: 5506
diff changeset
    79
     * KeyFactory.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     */
17491
7a33824ec8c5 7194075: Various classes of sunec.jar are duplicated in rt.jar
vinnie
parents: 5506
diff changeset
    81
    ECPrivateKeyImpl(BigInteger s, ECParameterSpec params)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
            throws InvalidKeyException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        this.s = s;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        this.params = params;
52946
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
    85
        makeEncoding(s);
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
    86
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
    87
    }
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
    88
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
    89
    ECPrivateKeyImpl(byte[] s, ECParameterSpec params)
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
    90
            throws InvalidKeyException {
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
    91
        this.arrayS = s.clone();
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
    92
        this.params = params;
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
    93
        makeEncoding(s);
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
    94
    }
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
    95
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
    96
    private void makeEncoding(byte[] s) throws InvalidKeyException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        algid = new AlgorithmId
52946
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
    98
        (AlgorithmId.EC_oid, ECParameters.getAlgorithmParameters(params));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
            DerOutputStream out = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
            out.putInteger(1); // version 1
52946
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   102
            byte[] privBytes = s.clone();
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   103
            ArrayUtil.reverse(privBytes);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            out.putOctetString(privBytes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
            DerValue val =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                new DerValue(DerValue.tag_Sequence, out.toByteArray());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
            key = val.toByteArray();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        } catch (IOException exc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            // should never occur
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
            throw new InvalidKeyException(exc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
52946
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   114
    private void makeEncoding(BigInteger s) throws InvalidKeyException {
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   115
        algid = new AlgorithmId
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   116
        (AlgorithmId.EC_oid, ECParameters.getAlgorithmParameters(params));
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   117
        try {
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   118
            byte[] sArr = s.toByteArray();
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   119
            // convert to fixed-length array
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   120
            int numOctets = (params.getOrder().bitLength() + 7) / 8;
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   121
            byte[] sOctets = new byte[numOctets];
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   122
            int inPos = Math.max(sArr.length - sOctets.length, 0);
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   123
            int outPos = Math.max(sOctets.length - sArr.length, 0);
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   124
            int length = Math.min(sArr.length, sOctets.length);
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   125
            System.arraycopy(sArr, inPos, sOctets, outPos, length);
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   126
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   127
            DerOutputStream out = new DerOutputStream();
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   128
            out.putInteger(1); // version 1
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   129
            out.putOctetString(sOctets);
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   130
            DerValue val =
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   131
                new DerValue(DerValue.tag_Sequence, out.toByteArray());
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   132
            key = val.toByteArray();
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   133
        } catch (IOException exc) {
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   134
            // should never occur
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   135
            throw new InvalidKeyException(exc);
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   136
        }
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   137
    }
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   138
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    // see JCA doc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    public String getAlgorithm() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        return "EC";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    // see JCA doc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    public BigInteger getS() {
52946
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   146
        if (s == null) {
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   147
            byte[] arrCopy = arrayS.clone();
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   148
            ArrayUtil.reverse(arrCopy);
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   149
            s = new BigInteger(1, arrCopy);
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   150
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        return s;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
52946
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   154
    public byte[] getArrayS() {
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   155
        if (arrayS == null) {
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   156
            byte[] arr = getS().toByteArray();
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   157
            ArrayUtil.reverse(arr);
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   158
            int byteLength = (params.getOrder().bitLength() + 7) / 8;
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   159
            arrayS = new byte[byteLength];
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   160
            int length = Math.min(byteLength, arr.length);
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   161
            System.arraycopy(arr, 0, arrayS, 0, length);
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   162
        }
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   163
        return arrayS.clone();
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   164
    }
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   165
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    // see JCA doc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    public ECParameterSpec getParams() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        return params;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * Parse the key. Called by PKCS8Key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    protected void parseKeyBits() throws InvalidKeyException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            DerInputStream in = new DerInputStream(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            DerValue derValue = in.getDerValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
            if (derValue.tag != DerValue.tag_Sequence) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                throw new IOException("Not a SEQUENCE");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            DerInputStream data = derValue.data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
            int version = data.getInteger();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
            if (version != 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                throw new IOException("Version must be 1");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            byte[] privData = data.getOctetString();
52946
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   187
            ArrayUtil.reverse(privData);
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   188
            arrayS = privData;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
            while (data.available() != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                DerValue value = data.getDerValue();
52946
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   191
                if (value.isContextSpecific((byte) 0)) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                    // ignore for now
52946
752e57845ad2 8208698: Improved ECC Implementation
apetcher
parents: 47216
diff changeset
   193
                } else if (value.isContextSpecific((byte) 1)) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                    // ignore for now
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
                    throw new InvalidKeyException("Unexpected value: " + value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
            AlgorithmParameters algParams = this.algid.getParameters();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            if (algParams == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                throw new InvalidKeyException("EC domain parameters must be "
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                    + "encoded in the algorithm identifier");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
            params = algParams.getParameterSpec(ECParameterSpec.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        } catch (IOException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            throw new InvalidKeyException("Invalid EC private key", e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        } catch (InvalidParameterSpecException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
            throw new InvalidKeyException("Invalid EC private key", e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
}