1. /*
  2. * @(#)RSAPrivateCrtKeySpec.java 1.8 00/02/02
  3. *
  4. * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.security.spec;
  11. import java.math.BigInteger;
  12. /**
  13. * This class specifies an RSA private key, as defined in the PKCS#1
  14. * standard, using the Chinese Remainder Theorem (CRT) information values for
  15. * efficiency.
  16. *
  17. * @author Jan Luehe
  18. *
  19. * @version 1.8 00/02/02
  20. *
  21. * @see java.security.Key
  22. * @see java.security.KeyFactory
  23. * @see KeySpec
  24. * @see PKCS8EncodedKeySpec
  25. * @see RSAPrivateKeySpec
  26. * @see RSAPublicKeySpec
  27. */
  28. public class RSAPrivateCrtKeySpec extends RSAPrivateKeySpec {
  29. private BigInteger modulus;
  30. private BigInteger publicExponent;
  31. private BigInteger privateExponent;
  32. private BigInteger primeP;
  33. private BigInteger primeQ;
  34. private BigInteger primeExponentP;
  35. private BigInteger primeExponentQ;
  36. private BigInteger crtCoefficient;
  37. /**
  38. * Creates a new <code>RSAPrivateCrtKeySpec</code>
  39. * given the modulus, publicExponent, privateExponent,
  40. * primeP, primeQ, primeExponentP, primeExponentQ, and
  41. * crtCoefficient as defined in PKCS#1.
  42. *
  43. * @param modulus the modulus n
  44. * @param publicExponent the public exponent e
  45. * @param privateExponent the private exponent d
  46. * @param primeP the prime factor p of n
  47. * @param primeQ the prime factor q of n
  48. * @param primeExponentP this is d mod (p-1)
  49. * @param primeExponentQ this is d mod (q-1)
  50. * @param crtCoefficient the Chinese Remainder Theorem
  51. * coefficient q-1 mod p
  52. */
  53. public RSAPrivateCrtKeySpec(BigInteger modulus,
  54. BigInteger publicExponent,
  55. BigInteger privateExponent,
  56. BigInteger primeP,
  57. BigInteger primeQ,
  58. BigInteger primeExponentP,
  59. BigInteger primeExponentQ,
  60. BigInteger crtCoefficient) {
  61. super(modulus, privateExponent);
  62. this.publicExponent = publicExponent;
  63. this.primeP = primeP;
  64. this.primeQ = primeQ;
  65. this.primeExponentP = primeExponentP;
  66. this.primeExponentQ = primeExponentQ;
  67. this.crtCoefficient = crtCoefficient;
  68. }
  69. /**
  70. * Returns the public exponent.
  71. *
  72. * @return the public exponent
  73. */
  74. public BigInteger getPublicExponent() {
  75. return this.publicExponent;
  76. }
  77. /**
  78. * Returns the primeP.
  79. * @return the primeP
  80. */
  81. public BigInteger getPrimeP() {
  82. return this.primeP;
  83. }
  84. /**
  85. * Returns the primeQ.
  86. *
  87. * @return the primeQ
  88. */
  89. public BigInteger getPrimeQ() {
  90. return this.primeQ;
  91. }
  92. /**
  93. * Returns the primeExponentP.
  94. *
  95. * @return the primeExponentP
  96. */
  97. public BigInteger getPrimeExponentP() {
  98. return this.primeExponentP;
  99. }
  100. /**
  101. * Returns the primeExponentQ.
  102. *
  103. * @return the primeExponentQ
  104. */
  105. public BigInteger getPrimeExponentQ() {
  106. return this.primeExponentQ;
  107. }
  108. /**
  109. * Returns the crtCoefficient.
  110. *
  111. * @return the crtCoefficient
  112. */
  113. public BigInteger getCrtCoefficient() {
  114. return this.crtCoefficient;
  115. }
  116. }