KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > security > spec > X509EncodedKeySpec


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
8 package java.security.spec;
9
10 /**
11  * This class represents the ASN.1 encoding of a public key,
12  * encoded according to the ASN.1 type <code>SubjectPublicKeyInfo</code>.
13  * The <code>SubjectPublicKeyInfo</code> syntax is defined in the X.509
14  * standard as follows:
15  *
16  * <pre>
17  * SubjectPublicKeyInfo ::= SEQUENCE {
18  * algorithm AlgorithmIdentifier,
19  * subjectPublicKey BIT STRING }
20  * </pre>
21  *
22  * @author Jan Luehe
23  *
24  * @version 1.19, 12/19/03
25  *
26  * @see java.security.Key
27  * @see java.security.KeyFactory
28  * @see KeySpec
29  * @see EncodedKeySpec
30  * @see PKCS8EncodedKeySpec
31  *
32  * @since 1.2
33  */

34
35 public class X509EncodedKeySpec extends EncodedKeySpec JavaDoc {
36
37     /**
38      * Creates a new X509EncodedKeySpec with the given encoded key.
39      *
40      * @param encodedKey the key, which is assumed to be
41      * encoded according to the X.509 standard. The contents of the
42      * array are copied to protect against subsequent modification.
43      */

44     public X509EncodedKeySpec(byte[] encodedKey) {
45     super(encodedKey);
46     }
47
48     /**
49      * Returns the key bytes, encoded according to the X.509 standard.
50      *
51      * @return the X.509 encoding of the key. Returns a new array
52      * each time this method is called.
53      */

54     public byte[] getEncoded() {
55     return super.getEncoded();
56     }
57
58     /**
59      * Returns the name of the encoding format associated with this
60      * key specification.
61      *
62      * @return the string <code>"X.509"</code>.
63      */

64     public final String JavaDoc getFormat() {
65     return "X.509";
66     }
67 }
68
Popular Tags