KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > security > spec > ECPrivateKeySpec


1 /*
2  * @(#)ECPrivateKeySpec.java 1.3 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package java.security.spec;
8
9 import java.math.BigInteger JavaDoc;
10
11 /**
12  * This immutable class specifies an elliptic curve private key with
13  * its associated parameters.
14  *
15  * @see KeySpec
16  * @see ECParameterSpec
17  *
18  * @author Valerie Peng
19  * @version 1.3, 12/19/03
20  *
21  * @since 1.5
22  */

23 public class ECPrivateKeySpec implements KeySpec JavaDoc {
24     
25     private BigInteger JavaDoc s;
26     private ECParameterSpec JavaDoc params;
27
28     /**
29      * Creates a new ECPrivateKeySpec with the specified
30      * parameter values.
31      * @param s the private value.
32      * @param params the associated elliptic curve domain
33      * parameters.
34      * @exception NullPointerException if <code>s</code>
35      * or <code>params</code> is null.
36      */

37     public ECPrivateKeySpec(BigInteger JavaDoc s, ECParameterSpec JavaDoc params) {
38         if (s == null) {
39             throw new NullPointerException JavaDoc("s is null");
40         }
41         if (params == null) {
42             throw new NullPointerException JavaDoc("params is null");
43         }
44     this.s = s;
45     this.params = params;
46     }
47     
48     /**
49      * Returns the private value S.
50      * @return the private value S.
51      */

52     public BigInteger JavaDoc getS() {
53     return s;
54     }
55
56     /**
57      * Returns the associated elliptic curve domain
58      * parameters.
59      * @return the EC domain parameters.
60      */

61     public ECParameterSpec JavaDoc getParams() {
62     return params;
63     }
64 }
65
Popular Tags