1 7 8 package java.security.spec; 9 10 import java.math.BigInteger ; 11 12 31 32 public class RSAMultiPrimePrivateCrtKeySpec extends RSAPrivateKeySpec { 33 34 private final BigInteger publicExponent; 35 private final BigInteger primeP; 36 private final BigInteger primeQ; 37 private final BigInteger primeExponentP; 38 private final BigInteger primeExponentQ; 39 private final BigInteger crtCoefficient; 40 private final RSAOtherPrimeInfo otherPrimeInfo[]; 41 42 72 public RSAMultiPrimePrivateCrtKeySpec(BigInteger modulus, 73 BigInteger publicExponent, 74 BigInteger privateExponent, 75 BigInteger primeP, 76 BigInteger primeQ, 77 BigInteger primeExponentP, 78 BigInteger primeExponentQ, 79 BigInteger crtCoefficient, 80 RSAOtherPrimeInfo [] otherPrimeInfo) { 81 super(modulus, privateExponent); 82 if (modulus == null) { 83 throw new NullPointerException ("the modulus parameter must be " + 84 "non-null"); 85 } 86 if (publicExponent == null) { 87 throw new NullPointerException ("the publicExponent parameter " + 88 "must be non-null"); 89 } 90 if (privateExponent == null) { 91 throw new NullPointerException ("the privateExponent parameter " + 92 "must be non-null"); 93 } 94 if (primeP == null) { 95 throw new NullPointerException ("the primeP parameter " + 96 "must be non-null"); 97 } 98 if (primeQ == null) { 99 throw new NullPointerException ("the primeQ parameter " + 100 "must be non-null"); 101 } 102 if (primeExponentP == null) { 103 throw new NullPointerException ("the primeExponentP parameter " + 104 "must be non-null"); 105 } 106 if (primeExponentQ == null) { 107 throw new NullPointerException ("the primeExponentQ parameter " + 108 "must be non-null"); 109 } 110 if (crtCoefficient == null) { 111 throw new NullPointerException ("the crtCoefficient parameter " + 112 "must be non-null"); 113 } 114 this.publicExponent = publicExponent; 115 this.primeP = primeP; 116 this.primeQ = primeQ; 117 this.primeExponentP = primeExponentP; 118 this.primeExponentQ = primeExponentQ; 119 this.crtCoefficient = crtCoefficient; 120 if (otherPrimeInfo == null) { 121 this.otherPrimeInfo = null; 122 } else if (otherPrimeInfo.length == 0) { 123 throw new IllegalArgumentException ("the otherPrimeInfo " + 124 "parameter must not be empty"); 125 } else { 126 this.otherPrimeInfo = (RSAOtherPrimeInfo [])otherPrimeInfo.clone(); 127 } 128 } 129 130 135 public BigInteger getPublicExponent() { 136 return this.publicExponent; 137 } 138 139 144 public BigInteger getPrimeP() { 145 return this.primeP; 146 } 147 148 153 public BigInteger getPrimeQ() { 154 return this.primeQ; 155 } 156 157 162 public BigInteger getPrimeExponentP() { 163 return this.primeExponentP; 164 } 165 166 171 public BigInteger getPrimeExponentQ() { 172 return this.primeExponentQ; 173 } 174 175 180 public BigInteger getCrtCoefficient() { 181 return this.crtCoefficient; 182 } 183 184 191 public RSAOtherPrimeInfo [] getOtherPrimeInfo() { 192 if (otherPrimeInfo == null) return null; 193 return (RSAOtherPrimeInfo []) otherPrimeInfo.clone(); 194 } 195 } 196 | Popular Tags |