home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / security / spec / PKCS8EncodedKeySpec.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  1.6 KB  |  67 lines

  1. /*
  2.  * @(#)PKCS8EncodedKeySpec.java    1.6 98/03/18
  3.  *
  4.  * Copyright 1997 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.security.spec;
  16.  
  17. /**
  18.  * This class represents the DER encoding of a private key, according to the
  19.  * format specified in the PKCS #8 standard.
  20.  *
  21.  * @author Jan Luehe
  22.  *
  23.  * @version 1.6, 98/03/18
  24.  *
  25.  * @see java.security.Key
  26.  * @see java.security.KeyFactory
  27.  * @see KeySpec
  28.  * @see EncodedKeySpec
  29.  * @see X509EncodedKeySpec
  30.  *
  31.  * @since JDK1.2
  32.  */
  33.  
  34. public class PKCS8EncodedKeySpec extends EncodedKeySpec {
  35.  
  36.     private byte[] encodedKey;
  37.  
  38.     /**
  39.      * Creates a new PKCS8EncodedKeySpec with the specified encoded key.
  40.      * 
  41.      * @param encodedKey the key, which is assumed to be 
  42.      * encoded according to the PKCS #8 standard.
  43.      */
  44.     public PKCS8EncodedKeySpec(byte[] encodedKey) {
  45.     this.encodedKey = encodedKey;
  46.     }
  47.  
  48.     /**
  49.      * Returns the key bytes, encoded according to the PKCS #8 standard.
  50.      *
  51.      * @return the PKCS #8 encoding of the key.
  52.      */
  53.     public byte[] getEncoded() {
  54.     return this.encodedKey;
  55.     }
  56.  
  57.     /**
  58.      * Returns the name of the encoding format associated with this
  59.      * key specification.
  60.      *
  61.      * @return the string <code>"PKCS#8"</code>.
  62.      */
  63.     public final String getFormat() {
  64.     return "PKCS#8";
  65.     }
  66. }
  67.