01: /*
02: * @(#)PKCS8EncodedKeySpec.java 1.21 06/10/10
03: *
04: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: *
26: */
27:
28: package java.security.spec;
29:
30: /**
31: * This class represents the ASN.1 encoding of a private key,
32: * encoded according to the ASN.1 type <code>PrivateKeyInfo</code>.
33: * The <code>PrivateKeyInfo</code> syntax is defined in the PKCS#8 standard
34: * as follows:
35: *
36: * <pre>
37: * PrivateKeyInfo ::= SEQUENCE {
38: * version Version,
39: * privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,
40: * privateKey PrivateKey,
41: * attributes [0] IMPLICIT Attributes OPTIONAL }
42: *
43: * Version ::= INTEGER
44: *
45: * PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier
46: *
47: * PrivateKey ::= OCTET STRING
48: *
49: * Attributes ::= SET OF Attribute
50: * </pre>
51: *
52: * @author Jan Luehe
53: *
54: * @version 1.14, 02/02/00
55: *
56: * @see java.security.Key
57: * @see java.security.KeyFactory
58: * @see KeySpec
59: * @see EncodedKeySpec
60: * @see X509EncodedKeySpec
61: *
62: * @since 1.2
63: */
64:
65: public class PKCS8EncodedKeySpec extends EncodedKeySpec {
66:
67: /**
68: * Creates a new PKCS8EncodedKeySpec with the given encoded key.
69: *
70: * @param encodedKey the key, which is assumed to be
71: * encoded according to the PKCS #8 standard.
72: */
73: public PKCS8EncodedKeySpec(byte[] encodedKey) {
74: super (encodedKey);
75: }
76:
77: /**
78: * Returns the key bytes, encoded according to the PKCS #8 standard.
79: *
80: * @return the PKCS #8 encoding of the key.
81: */
82: public byte[] getEncoded() {
83: return super .getEncoded();
84: }
85:
86: /**
87: * Returns the name of the encoding format associated with this
88: * key specification.
89: *
90: * @return the string <code>"PKCS#8"</code>.
91: */
92: public final String getFormat() {
93: return "PKCS#8";
94: }
95: }
|