KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)RSAPrivateCrtKeySpec.java 1.12 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 specifies an RSA private key, as defined in the PKCS#1
14  * standard, using the Chinese Remainder Theorem (CRT) information values for
15  * efficiency.
16  *
17  * @author Jan Luehe
18  *
19  * @version 1.12 03/12/19
20  *
21  * @see java.security.Key
22  * @see java.security.KeyFactory
23  * @see KeySpec
24  * @see PKCS8EncodedKeySpec
25  * @see RSAPrivateKeySpec
26  * @see RSAPublicKeySpec
27  */

28
29 public class RSAPrivateCrtKeySpec extends RSAPrivateKeySpec JavaDoc {
30
31     private final BigInteger JavaDoc publicExponent;
32     private final BigInteger JavaDoc primeP;
33     private final BigInteger JavaDoc primeQ;
34     private final BigInteger JavaDoc primeExponentP;
35     private final BigInteger JavaDoc primeExponentQ;
36     private final BigInteger JavaDoc crtCoefficient;
37
38
39
40    /**
41     * Creates a new <code>RSAPrivateCrtKeySpec</code>
42     * given the modulus, publicExponent, privateExponent,
43     * primeP, primeQ, primeExponentP, primeExponentQ, and
44     * crtCoefficient as defined in PKCS#1.
45     *
46     * @param modulus the modulus n
47     * @param publicExponent the public exponent e
48     * @param privateExponent the private exponent d
49     * @param primeP the prime factor p of n
50     * @param primeQ the prime factor q of n
51     * @param primeExponentP this is d mod (p-1)
52     * @param primeExponentQ this is d mod (q-1)
53     * @param crtCoefficient the Chinese Remainder Theorem
54     * coefficient q-1 mod p
55     */

56     public RSAPrivateCrtKeySpec(BigInteger JavaDoc modulus,
57                 BigInteger JavaDoc publicExponent,
58                 BigInteger JavaDoc privateExponent,
59                 BigInteger JavaDoc primeP,
60                 BigInteger JavaDoc primeQ,
61                 BigInteger JavaDoc primeExponentP,
62                 BigInteger JavaDoc primeExponentQ,
63                 BigInteger JavaDoc crtCoefficient) {
64     super(modulus, privateExponent);
65     this.publicExponent = publicExponent;
66     this.primeP = primeP;
67     this.primeQ = primeQ;
68     this.primeExponentP = primeExponentP;
69     this.primeExponentQ = primeExponentQ;
70     this.crtCoefficient = crtCoefficient;
71     }
72
73     /**
74      * Returns the public exponent.
75      *
76      * @return the public exponent
77      */

78     public BigInteger JavaDoc getPublicExponent() {
79     return this.publicExponent;
80     }
81
82     /**
83      * Returns the primeP.
84
85      * @return the primeP
86      */

87     public BigInteger JavaDoc getPrimeP() {
88     return this.primeP;
89     }
90
91     /**
92      * Returns the primeQ.
93      *
94      * @return the primeQ
95      */

96     public BigInteger JavaDoc getPrimeQ() {
97     return this.primeQ;
98     }
99
100     /**
101      * Returns the primeExponentP.
102      *
103      * @return the primeExponentP
104      */

105     public BigInteger JavaDoc getPrimeExponentP() {
106     return this.primeExponentP;
107     }
108
109     /**
110      * Returns the primeExponentQ.
111      *
112      * @return the primeExponentQ
113      */

114     public BigInteger JavaDoc getPrimeExponentQ() {
115     return this.primeExponentQ;
116     }
117
118     /**
119      * Returns the crtCoefficient.
120      *
121      * @return the crtCoefficient
122      */

123     public BigInteger JavaDoc getCrtCoefficient() {
124     return this.crtCoefficient;
125     }
126 }
127
Popular Tags