01 /*
02 * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
03 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04 *
05 * This code is free software; you can redistribute it and/or modify it
06 * under the terms of the GNU General Public License version 2 only, as
07 * published by the Free Software Foundation. Sun designates this
08 * particular file as subject to the "Classpath" exception as provided
09 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26 package java.security.spec;
27
28 /**
29 * This class represents the ASN.1 encoding of a public key,
30 * encoded according to the ASN.1 type <code>SubjectPublicKeyInfo</code>.
31 * The <code>SubjectPublicKeyInfo</code> syntax is defined in the X.509
32 * standard as follows:
33 *
34 * <pre>
35 * SubjectPublicKeyInfo ::= SEQUENCE {
36 * algorithm AlgorithmIdentifier,
37 * subjectPublicKey BIT STRING }
38 * </pre>
39 *
40 * @author Jan Luehe
41 *
42 * @version 1.28, 05/05/07
43 *
44 * @see java.security.Key
45 * @see java.security.KeyFactory
46 * @see KeySpec
47 * @see EncodedKeySpec
48 * @see PKCS8EncodedKeySpec
49 *
50 * @since 1.2
51 */
52
53 public class X509EncodedKeySpec extends EncodedKeySpec {
54
55 /**
56 * Creates a new X509EncodedKeySpec with the given encoded key.
57 *
58 * @param encodedKey the key, which is assumed to be
59 * encoded according to the X.509 standard. The contents of the
60 * array are copied to protect against subsequent modification.
61 * @exception NullPointerException if <code>encodedKey</code>
62 * is null.
63 */
64 public X509EncodedKeySpec(byte[] encodedKey) {
65 super (encodedKey);
66 }
67
68 /**
69 * Returns the key bytes, encoded according to the X.509 standard.
70 *
71 * @return the X.509 encoding of the key. Returns a new array
72 * each time this method is called.
73 */
74 public byte[] getEncoded() {
75 return super .getEncoded();
76 }
77
78 /**
79 * Returns the name of the encoding format associated with this
80 * key specification.
81 *
82 * @return the string <code>"X.509"</code>.
83 */
84 public final String getFormat() {
85 return "X.509";
86 }
87 }
|