1. /*
  2. * @(#)ECPrivateKeySpec.java 1.3 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 immutable class specifies an elliptic curve private key with
  11. * its associated parameters.
  12. *
  13. * @see KeySpec
  14. * @see ECParameterSpec
  15. *
  16. * @author Valerie Peng
  17. * @version 1.3, 12/19/03
  18. *
  19. * @since 1.5
  20. */
  21. public class ECPrivateKeySpec implements KeySpec {
  22. private BigInteger s;
  23. private ECParameterSpec params;
  24. /**
  25. * Creates a new ECPrivateKeySpec with the specified
  26. * parameter values.
  27. * @param s the private value.
  28. * @param params the associated elliptic curve domain
  29. * parameters.
  30. * @exception NullPointerException if <code>s</code>
  31. * or <code>params</code> is null.
  32. */
  33. public ECPrivateKeySpec(BigInteger s, ECParameterSpec params) {
  34. if (s == null) {
  35. throw new NullPointerException("s is null");
  36. }
  37. if (params == null) {
  38. throw new NullPointerException("params is null");
  39. }
  40. this.s = s;
  41. this.params = params;
  42. }
  43. /**
  44. * Returns the private value S.
  45. * @return the private value S.
  46. */
  47. public BigInteger getS() {
  48. return s;
  49. }
  50. /**
  51. * Returns the associated elliptic curve domain
  52. * parameters.
  53. * @return the EC domain parameters.
  54. */
  55. public ECParameterSpec getParams() {
  56. return params;
  57. }
  58. }