aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/spongycastle/core/src/main/jdk1.2/java/security/spec/RSAOtherPrimeInfo.java
blob: 42a4fce6d2e50c278d5df367b644e5106302f029 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package java.security.spec;

import java.math.BigInteger;

/**
 * This class represents the triplet (prime, exponent, and coefficient)
 * inside RSA's OtherPrimeInfo structure, as defined in the PKCS#1 v2.1.
 * The ASN.1 syntax of RSA's OtherPrimeInfo is as follows: 
 * 
 * <pre>
 * OtherPrimeInfo ::= SEQUENCE {
 *    prime INTEGER,
 *    exponent INTEGER,
 *    coefficient INTEGER
 * }
 * </pre>
 */
public class RSAOtherPrimeInfo
extends Object
{
	private BigInteger prime;
	private BigInteger primeExponent;
	private BigInteger crtCoefficient;

	/**
	 * Creates a new RSAOtherPrimeInfo given the prime, primeExponent,
	 * and crtCoefficient as defined in PKCS#1. 
	 *
	 * @param prime - the prime factor of n.
	 * @param primeExponent - the exponent.
	 * @param crtCoefficient - the Chinese Remainder Theorem coefficient. 
	 * @throws NullPointerException - if any of the parameters, i.e. prime,
	 *     primeExponent, crtCoefficient, is null.
	*/
	public RSAOtherPrimeInfo(
		BigInteger prime,
		BigInteger primeExponent,
		BigInteger crtCoefficient)
	{
		if ( prime == null || primeExponent == null || crtCoefficient == null )
		{
			throw new NullPointerException("Null parameter");
		}

		this.prime = prime;
		this.primeExponent = primeExponent;
		this.crtCoefficient = crtCoefficient;
	}

	/**
	 * Returns the prime. 
	 * 
	 * @returns the prime.
	 */
	public final BigInteger getPrime()
	{
		return prime;
	}

	/**
	 * Returns the prime's exponent. 
	 * 
	 * @returns the primeExponent.
	 */
	public final BigInteger getExponent()
	{
		return primeExponent;
	}

	/**
	 * Returns the prime's crtCoefficient. 
	 * 
	 * @returns the crtCoefficient.
	 */
	public final BigInteger getCrtCoefficient()
	{
		return crtCoefficient;
	}
}