1. /*
  2. * @(#)DSAPrivateKeySpec.java 1.17 03/01/23
  3. *
  4. * Copyright 2003 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 specifies a DSA private key with its associated parameters.
  11. *
  12. * @author Jan Luehe
  13. *
  14. * @version 1.17, 01/23/03
  15. *
  16. * @see java.security.Key
  17. * @see java.security.KeyFactory
  18. * @see KeySpec
  19. * @see DSAPublicKeySpec
  20. * @see PKCS8EncodedKeySpec
  21. *
  22. * @since 1.2
  23. */
  24. public class DSAPrivateKeySpec implements KeySpec {
  25. private BigInteger x;
  26. private BigInteger p;
  27. private BigInteger q;
  28. private BigInteger g;
  29. /**
  30. * Creates a new DSAPrivateKeySpec with the specified parameter values.
  31. *
  32. * @param x the private key.
  33. *
  34. * @param p the prime.
  35. *
  36. * @param q the sub-prime.
  37. *
  38. * @param g the base.
  39. */
  40. public DSAPrivateKeySpec(BigInteger x, BigInteger p, BigInteger q,
  41. BigInteger g) {
  42. this.x = x;
  43. this.p = p;
  44. this.q = q;
  45. this.g = g;
  46. }
  47. /**
  48. * Returns the private key <code>x</code>.
  49. *
  50. * @return the private key <code>x</code>.
  51. */
  52. public BigInteger getX() {
  53. return this.x;
  54. }
  55. /**
  56. * Returns the prime <code>p</code>.
  57. *
  58. * @return the prime <code>p</code>.
  59. */
  60. public BigInteger getP() {
  61. return this.p;
  62. }
  63. /**
  64. * Returns the sub-prime <code>q</code>.
  65. *
  66. * @return the sub-prime <code>q</code>.
  67. */
  68. public BigInteger getQ() {
  69. return this.q;
  70. }
  71. /**
  72. * Returns the base <code>g</code>.
  73. *
  74. * @return the base <code>g</code>.
  75. */
  76. public BigInteger getG() {
  77. return this.g;
  78. }
  79. }