1/* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18package java.security.spec; 19 20import java.math.BigInteger; 21 22/** 23 * The additional prime information specified as triplet of primes, a prime 24 * exponent, and a Chinese Remainder Theorem (CRT) coefficient. 25 * <p> 26 * Defined in the <a 27 * href="http://www.rsa.com/rsalabs/pubs/PKCS/html/pkcs-1.html">PKCS #1 v2.1</a> 28 * standard. 29 */ 30public class RSAOtherPrimeInfo { 31 // Prime 32 private final BigInteger prime; 33 // Prime Exponent 34 private final BigInteger primeExponent; 35 // CRT Coefficient 36 private final BigInteger crtCoefficient; 37 38 /** 39 * Creates a new {@code RSAOtherPrimeInfo} with the specified prime, 40 * exponent, and CRT coefficient. 41 * 42 * @param prime 43 * the prime factor. 44 * @param primeExponent 45 * the prime exponent. 46 * @param crtCoefficient 47 * the CRT coefficient. 48 */ 49 public RSAOtherPrimeInfo(BigInteger prime, 50 BigInteger primeExponent, BigInteger crtCoefficient) { 51 if (prime == null) { 52 throw new NullPointerException("prime == null"); 53 } 54 if (primeExponent == null) { 55 throw new NullPointerException("primeExponent == null"); 56 } 57 if (crtCoefficient == null) { 58 throw new NullPointerException("crtCoefficient == null"); 59 } 60 this.prime = prime; 61 this.primeExponent = primeExponent; 62 this.crtCoefficient = crtCoefficient; 63 } 64 65 /** 66 * Returns the CRT coefficient. 67 * 68 * @return the CRT coefficient. 69 */ 70 public final BigInteger getCrtCoefficient() { 71 return crtCoefficient; 72 } 73 74 /** 75 * Returns the prime factor. 76 * 77 * @return the prime factor. 78 */ 79 public final BigInteger getPrime() { 80 return prime; 81 } 82 83 /** 84 * Returns the exponent. 85 * 86 * @return the exponent. 87 */ 88 public final BigInteger getExponent() { 89 return primeExponent; 90 } 91} 92