1. /*
  2. * @(#)PKCS8EncodedKeySpec.java 1.14 00/02/02
  3. *
  4. * Copyright 1997-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. /**
  12. * This class represents the ASN.1 encoding of a private key,
  13. * encoded according to the ASN.1 type <code>PrivateKeyInfo</code>,
  14. * whose syntax is defined in the PKCS#8 standard, as follows:
  15. *
  16. * <pre>
  17. * PrivateKeyInfo ::= SEQUENCE {
  18. * version Version,
  19. * privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,
  20. * privateKey PrivateKey,
  21. * attributes [0] IMPLICIT Attributes OPTIONAL }
  22. *
  23. * Version ::= INTEGER
  24. *
  25. * PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier
  26. *
  27. * PrivateKey ::= OCTET STRING
  28. *
  29. * Attributes ::= SET OF Attribute
  30. * </pre>
  31. *
  32. * @author Jan Luehe
  33. *
  34. * @version 1.14, 02/02/00
  35. *
  36. * @see java.security.Key
  37. * @see java.security.KeyFactory
  38. * @see KeySpec
  39. * @see EncodedKeySpec
  40. * @see X509EncodedKeySpec
  41. *
  42. * @since 1.2
  43. */
  44. public class PKCS8EncodedKeySpec extends EncodedKeySpec {
  45. /**
  46. * Creates a new PKCS8EncodedKeySpec with the given encoded key.
  47. *
  48. * @param encodedKey the key, which is assumed to be
  49. * encoded according to the PKCS #8 standard.
  50. */
  51. public PKCS8EncodedKeySpec(byte[] encodedKey) {
  52. super(encodedKey);
  53. }
  54. /**
  55. * Returns the key bytes, encoded according to the PKCS #8 standard.
  56. *
  57. * @return the PKCS #8 encoding of the key.
  58. */
  59. public byte[] getEncoded() {
  60. return super.getEncoded();
  61. }
  62. /**
  63. * Returns the name of the encoding format associated with this
  64. * key specification.
  65. *
  66. * @return the string <code>"PKCS#8"</code>.
  67. */
  68. public final String getFormat() {
  69. return "PKCS#8";
  70. }
  71. }