0N/A/*
2362N/A * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.security.spec;
0N/A
0N/A/**
0N/A * This class represents the ASN.1 encoding of a private key,
0N/A * encoded according to the ASN.1 type <code>PrivateKeyInfo</code>.
0N/A * The <code>PrivateKeyInfo</code> syntax is defined in the PKCS#8 standard
0N/A * as follows:
0N/A *
0N/A * <pre>
0N/A * PrivateKeyInfo ::= SEQUENCE {
0N/A * version Version,
0N/A * privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,
0N/A * privateKey PrivateKey,
0N/A * attributes [0] IMPLICIT Attributes OPTIONAL }
0N/A *
0N/A * Version ::= INTEGER
0N/A *
0N/A * PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier
0N/A *
0N/A * PrivateKey ::= OCTET STRING
0N/A *
0N/A * Attributes ::= SET OF Attribute
0N/A * </pre>
0N/A *
0N/A * @author Jan Luehe
0N/A *
0N/A *
0N/A * @see java.security.Key
0N/A * @see java.security.KeyFactory
0N/A * @see KeySpec
0N/A * @see EncodedKeySpec
0N/A * @see X509EncodedKeySpec
0N/A *
0N/A * @since 1.2
0N/A */
0N/A
0N/Apublic class PKCS8EncodedKeySpec extends EncodedKeySpec {
0N/A
0N/A /**
0N/A * Creates a new PKCS8EncodedKeySpec with the given encoded key.
0N/A *
0N/A * @param encodedKey the key, which is assumed to be
0N/A * encoded according to the PKCS #8 standard. The contents of
0N/A * the array are copied to protect against subsequent modification.
0N/A * @exception NullPointerException if <code>encodedKey</code>
0N/A * is null.
0N/A */
0N/A public PKCS8EncodedKeySpec(byte[] encodedKey) {
0N/A super(encodedKey);
0N/A }
0N/A
0N/A /**
0N/A * Returns the key bytes, encoded according to the PKCS #8 standard.
0N/A *
0N/A * @return the PKCS #8 encoding of the key. Returns a new array
0N/A * each time this method is called.
0N/A */
0N/A public byte[] getEncoded() {
0N/A return super.getEncoded();
0N/A }
0N/A
0N/A /**
0N/A * Returns the name of the encoding format associated with this
0N/A * key specification.
0N/A *
0N/A * @return the string <code>"PKCS#8"</code>.
0N/A */
0N/A public final String getFormat() {
0N/A return "PKCS#8";
0N/A }
0N/A}