KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)ECPublicKeySpec.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 /**
10  * This immutable class specifies an elliptic curve public key with
11  * its associated parameters.
12  *
13  * @see KeySpec
14  * @see ECPoint
15  * @see ECParameterSpec
16  *
17  * @author Valerie Peng
18  * @version 1.3, 12/19/03
19  *
20  * @since 1.5
21  */

22 public class ECPublicKeySpec implements KeySpec JavaDoc {
23
24     private ECPoint JavaDoc w;
25     private ECParameterSpec JavaDoc params;
26
27     /**
28      * Creates a new ECPublicKeySpec with the specified
29      * parameter values.
30      * @param w the public point.
31      * @param params the associated elliptic curve domain
32      * parameters.
33      * @exception NullPointerException if <code>w</code>
34      * or <code>params</code> is null.
35      * @exception IllegalArgumentException if <code>w</code>
36      * is point at infinity, i.e. ECPoint.POINT_INFINITY
37      */

38     public ECPublicKeySpec(ECPoint JavaDoc w, ECParameterSpec JavaDoc params) {
39     if (w == null) {
40             throw new NullPointerException JavaDoc("w is null");
41         }
42         if (params == null) {
43             throw new NullPointerException JavaDoc("params is null");
44         }
45     if (w == ECPoint.POINT_INFINITY) {
46         throw new IllegalArgumentException JavaDoc("w is ECPoint.POINT_INFINITY");
47     }
48         this.w = w;
49         this.params = params;
50     }
51
52     /**
53      * Returns the public point W.
54      * @return the public point W.
55      */

56     public ECPoint JavaDoc getW() {
57     return w;
58     }
59
60     /**
61      * Returns the associated elliptic curve domain
62      * parameters.
63      * @return the EC domain parameters.
64      */

65     public ECParameterSpec JavaDoc getParams() {
66     return params;
67     }
68 }
69
Popular Tags