001: /*
002: * @(#)RSAPrivateCrtKeySpec.java 1.14 06/10/10
003: *
004: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License version
009: * 2 only, as published by the Free Software Foundation.
010: *
011: * This program is distributed in the hope that it will be useful, but
012: * WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * General Public License version 2 for more details (a copy is
015: * included at /legal/license.txt).
016: *
017: * You should have received a copy of the GNU General Public License
018: * version 2 along with this work; if not, write to the Free Software
019: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA
021: *
022: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023: * Clara, CA 95054 or visit www.sun.com if you need additional
024: * information or have any questions.
025: *
026: */
027:
028: package java.security.spec;
029:
030: import java.math.BigInteger;
031:
032: /**
033: * This class specifies an RSA private key, as defined in the PKCS#1
034: * standard, using the Chinese Remainder Theorem (CRT) information values for
035: * efficiency.
036: *
037: * @author Jan Luehe
038: *
039: * @version 1.8 00/02/02
040: *
041: * @see java.security.Key
042: * @see java.security.KeyFactory
043: * @see KeySpec
044: * @see PKCS8EncodedKeySpec
045: * @see RSAPrivateKeySpec
046: * @see RSAPublicKeySpec
047: */
048:
049: public class RSAPrivateCrtKeySpec extends RSAPrivateKeySpec {
050:
051: private BigInteger modulus;
052: private BigInteger publicExponent;
053: private BigInteger privateExponent;
054: private BigInteger primeP;
055: private BigInteger primeQ;
056: private BigInteger primeExponentP;
057: private BigInteger primeExponentQ;
058: private BigInteger crtCoefficient;
059:
060: /**
061: * Creates a new <code>RSAPrivateCrtKeySpec</code>
062: * given the modulus, publicExponent, privateExponent,
063: * primeP, primeQ, primeExponentP, primeExponentQ, and
064: * crtCoefficient as defined in PKCS#1.
065: *
066: * @param modulus the modulus n
067: * @param publicExponent the public exponent e
068: * @param privateExponent the private exponent d
069: * @param primeP the prime factor p of n
070: * @param primeQ the prime factor q of n
071: * @param primeExponentP this is d mod (p-1)
072: * @param primeExponentQ this is d mod (q-1)
073: * @param crtCoefficient the Chinese Remainder Theorem
074: * coefficient q-1 mod p
075: */
076: public RSAPrivateCrtKeySpec(BigInteger modulus,
077: BigInteger publicExponent, BigInteger privateExponent,
078: BigInteger primeP, BigInteger primeQ,
079: BigInteger primeExponentP, BigInteger primeExponentQ,
080: BigInteger crtCoefficient) {
081: super (modulus, privateExponent);
082: this .publicExponent = publicExponent;
083: this .primeP = primeP;
084: this .primeQ = primeQ;
085: this .primeExponentP = primeExponentP;
086: this .primeExponentQ = primeExponentQ;
087: this .crtCoefficient = crtCoefficient;
088: }
089:
090: /**
091: * Returns the public exponent.
092: *
093: * @return the public exponent
094: */
095: public BigInteger getPublicExponent() {
096: return this .publicExponent;
097: }
098:
099: /**
100: * Returns the primeP.
101:
102: * @return the primeP
103: */
104: public BigInteger getPrimeP() {
105: return this .primeP;
106: }
107:
108: /**
109: * Returns the primeQ.
110: *
111: * @return the primeQ
112: */
113: public BigInteger getPrimeQ() {
114: return this .primeQ;
115: }
116:
117: /**
118: * Returns the primeExponentP.
119: *
120: * @return the primeExponentP
121: */
122: public BigInteger getPrimeExponentP() {
123: return this .primeExponentP;
124: }
125:
126: /**
127: * Returns the primeExponentQ.
128: *
129: * @return the primeExponentQ
130: */
131: public BigInteger getPrimeExponentQ() {
132: return this .primeExponentQ;
133: }
134:
135: /**
136: * Returns the crtCoefficient.
137: *
138: * @return the crtCoefficient
139: */
140: public BigInteger getCrtCoefficient() {
141: return this.crtCoefficient;
142: }
143: }
|