1. /*
  2. * @(#)X509EncodedKeySpec.java 1.19 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. /**
  9. * This class represents the ASN.1 encoding of a public key,
  10. * encoded according to the ASN.1 type <code>SubjectPublicKeyInfo</code>.
  11. * The <code>SubjectPublicKeyInfo</code> syntax is defined in the X.509
  12. * standard as follows:
  13. *
  14. * <pre>
  15. * SubjectPublicKeyInfo ::= SEQUENCE {
  16. * algorithm AlgorithmIdentifier,
  17. * subjectPublicKey BIT STRING }
  18. * </pre>
  19. *
  20. * @author Jan Luehe
  21. *
  22. * @version 1.19, 12/19/03
  23. *
  24. * @see java.security.Key
  25. * @see java.security.KeyFactory
  26. * @see KeySpec
  27. * @see EncodedKeySpec
  28. * @see PKCS8EncodedKeySpec
  29. *
  30. * @since 1.2
  31. */
  32. public class X509EncodedKeySpec extends EncodedKeySpec {
  33. /**
  34. * Creates a new X509EncodedKeySpec with the given encoded key.
  35. *
  36. * @param encodedKey the key, which is assumed to be
  37. * encoded according to the X.509 standard. The contents of the
  38. * array are copied to protect against subsequent modification.
  39. */
  40. public X509EncodedKeySpec(byte[] encodedKey) {
  41. super(encodedKey);
  42. }
  43. /**
  44. * Returns the key bytes, encoded according to the X.509 standard.
  45. *
  46. * @return the X.509 encoding of the key. Returns a new array
  47. * each time this method is called.
  48. */
  49. public byte[] getEncoded() {
  50. return super.getEncoded();
  51. }
  52. /**
  53. * Returns the name of the encoding format associated with this
  54. * key specification.
  55. *
  56. * @return the string <code>"X.509"</code>.
  57. */
  58. public final String getFormat() {
  59. return "X.509";
  60. }
  61. }