KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)RSAOtherPrimeInfo.java 1.6 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
8 package java.security.spec;
9
10 import java.math.BigInteger JavaDoc;
11
12 /**
13  * This class represents the triplet (prime, exponent, and coefficient)
14  * inside RSA's OtherPrimeInfo structure, as defined in the PKCS#1 v2.1.
15  * The ASN.1 syntax of RSA's OtherPrimeInfo is as follows:
16  *
17  * <pre>
18  * OtherPrimeInfo ::= SEQUENCE {
19  * prime INTEGER,
20  * exponent INTEGER,
21  * coefficient INTEGER
22  * }
23  *
24  * </pre>
25  *
26  * @author Valerie Peng
27  *
28  * @version 1.6 03/12/19
29  *
30  * @see RSAPrivateCrtKeySpec
31  * @see java.security.interfaces.RSAMultiPrimePrivateCrtKey
32  *
33  * @since 1.4
34  */

35
36 public class RSAOtherPrimeInfo {
37
38     private BigInteger JavaDoc prime;
39     private BigInteger JavaDoc primeExponent;
40     private BigInteger JavaDoc crtCoefficient;
41
42
43    /**
44     * Creates a new <code>RSAOtherPrimeInfo</code>
45     * given the prime, primeExponent, and
46     * crtCoefficient as defined in PKCS#1.
47     *
48     * @param prime the prime factor of n.
49     * @param primeExponent the exponent.
50     * @param crtCoefficient the Chinese Remainder Theorem
51     * coefficient.
52     * @exception NullPointerException if any of the parameters, i.e.
53     * <code>prime</code>, <code>primeExponent</code>,
54     * <code>crtCoefficient</code>, is null.
55     *
56     */

57     public RSAOtherPrimeInfo(BigInteger JavaDoc prime,
58               BigInteger JavaDoc primeExponent,
59               BigInteger JavaDoc crtCoefficient) {
60     if (prime == null) {
61         throw new NullPointerException JavaDoc("the prime parameter must be " +
62                         "non-null");
63     }
64     if (primeExponent == null) {
65         throw new NullPointerException JavaDoc("the primeExponent parameter " +
66                         "must be non-null");
67     }
68     if (crtCoefficient == null) {
69         throw new NullPointerException JavaDoc("the crtCoefficient parameter " +
70                         "must be non-null");
71     }
72     this.prime = prime;
73     this.primeExponent = primeExponent;
74     this.crtCoefficient = crtCoefficient;
75     }
76
77     /**
78      * Returns the prime.
79      *
80      * @return the prime.
81      */

82     public final BigInteger JavaDoc getPrime() {
83     return this.prime;
84     }
85
86     /**
87      * Returns the prime's exponent.
88      *
89      * @return the primeExponent.
90      */

91     public final BigInteger JavaDoc getExponent() {
92     return this.primeExponent;
93     }
94
95     /**
96      * Returns the prime's crtCoefficient.
97      *
98      * @return the crtCoefficient.
99      */

100     public final BigInteger JavaDoc getCrtCoefficient() {
101     return this.crtCoefficient;
102     }
103 }
104
Popular Tags