1. /*
  2. * @(#)RSAOtherPrimeInfo.java 1.6 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. package java.security.spec;
  8. import java.math.BigInteger;
  9. /**
  10. * This class represents the triplet (prime, exponent, and coefficient)
  11. * inside RSA's OtherPrimeInfo structure, as defined in the PKCS#1 v2.1.
  12. * The ASN.1 syntax of RSA's OtherPrimeInfo is as follows:
  13. *
  14. * <pre>
  15. * OtherPrimeInfo ::= SEQUENCE {
  16. * prime INTEGER,
  17. * exponent INTEGER,
  18. * coefficient INTEGER
  19. * }
  20. *
  21. * </pre>
  22. *
  23. * @author Valerie Peng
  24. *
  25. * @version 1.6 03/12/19
  26. *
  27. * @see RSAPrivateCrtKeySpec
  28. * @see java.security.interfaces.RSAMultiPrimePrivateCrtKey
  29. *
  30. * @since 1.4
  31. */
  32. public class RSAOtherPrimeInfo {
  33. private BigInteger prime;
  34. private BigInteger primeExponent;
  35. private BigInteger crtCoefficient;
  36. /**
  37. * Creates a new <code>RSAOtherPrimeInfo</code>
  38. * given the prime, primeExponent, and
  39. * crtCoefficient as defined in PKCS#1.
  40. *
  41. * @param prime the prime factor of n.
  42. * @param primeExponent the exponent.
  43. * @param crtCoefficient the Chinese Remainder Theorem
  44. * coefficient.
  45. * @exception NullPointerException if any of the parameters, i.e.
  46. * <code>prime</code>, <code>primeExponent</code>,
  47. * <code>crtCoefficient</code>, is null.
  48. *
  49. */
  50. public RSAOtherPrimeInfo(BigInteger prime,
  51. BigInteger primeExponent,
  52. BigInteger crtCoefficient) {
  53. if (prime == null) {
  54. throw new NullPointerException("the prime parameter must be " +
  55. "non-null");
  56. }
  57. if (primeExponent == null) {
  58. throw new NullPointerException("the primeExponent parameter " +
  59. "must be non-null");
  60. }
  61. if (crtCoefficient == null) {
  62. throw new NullPointerException("the crtCoefficient parameter " +
  63. "must be non-null");
  64. }
  65. this.prime = prime;
  66. this.primeExponent = primeExponent;
  67. this.crtCoefficient = crtCoefficient;
  68. }
  69. /**
  70. * Returns the prime.
  71. *
  72. * @return the prime.
  73. */
  74. public final BigInteger getPrime() {
  75. return this.prime;
  76. }
  77. /**
  78. * Returns the prime's exponent.
  79. *
  80. * @return the primeExponent.
  81. */
  82. public final BigInteger getExponent() {
  83. return this.primeExponent;
  84. }
  85. /**
  86. * Returns the prime's crtCoefficient.
  87. *
  88. * @return the crtCoefficient.
  89. */
  90. public final BigInteger getCrtCoefficient() {
  91. return this.crtCoefficient;
  92. }
  93. }