KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > security > jauth > callback > SignatureKeyCallback


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.security.jauth.callback;
25
26 import java.security.KeyStore JavaDoc;
27 import java.security.PrivateKey JavaDoc;
28 import javax.crypto.SecretKey;
29 import java.security.cert.Certificate JavaDoc;
30 import javax.security.auth.callback.Callback JavaDoc;
31 import javax.security.auth.x500.X500Principal JavaDoc;
32
33 /**
34  * Callback for Signing Key.
35  *
36  * @version 1.8, 03/03/04
37  */

38 public class SignatureKeyCallback implements Callback JavaDoc {
39
40     private PrivateKey JavaDoc key;
41     private X500Principal JavaDoc authority;
42     private Certificate JavaDoc[] chain;
43
44     /**
45      * Constructs this SignatureKeyCallback with an authority.
46      *
47      * <p> Both a PrivateKey and corresponding certificate chain
48      * will be returned. The <i>authority</i> input parameter
49      * specifies the X500Principal name of the root CA
50      * certificate returned in the chain.
51      * An authority does not have to be specified.
52      *
53      * @param authority the X500Principal name of the root CA
54      * certificate returned in the requested chain,
55      * or null
56      */

57     public SignatureKeyCallback(X500Principal JavaDoc authority) {
58     this.authority = authority;
59     }
60
61     /**
62      * Get the authority.
63      *
64      * @return the authority, or null
65      */

66     public X500Principal JavaDoc getAuthority() {
67     return authority;
68     }
69
70     /**
71      * Set the requested signing key.
72      *
73      * @param key the signing key
74      * @param chain the corresponding certificate chain
75      */

76     public void setKey(PrivateKey JavaDoc key, Certificate JavaDoc[] chain) {
77     this.key = key;
78     this.chain = chain;
79     }
80
81     /**
82      * Get the requested signing key.
83      *
84      * @return the signing key
85      */

86     public PrivateKey JavaDoc getKey() {
87     return key;
88     }
89
90     /**
91      * Get the certificate chain.
92      *
93      * @return the certificate chain
94      */

95     public Certificate JavaDoc[] getChain() {
96     return chain;
97     }
98 }
99
Popular Tags