KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > management > geronimo > CertificationAuthority


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.geronimo.management.geronimo;
19
20 import java.math.BigInteger JavaDoc;
21 import java.security.PublicKey JavaDoc;
22 import java.security.cert.Certificate JavaDoc;
23 import java.util.Date JavaDoc;
24
25 import javax.security.auth.x500.X500Principal JavaDoc;
26
27 import org.apache.geronimo.management.geronimo.CertificationAuthorityException;
28
29 /**
30  * Management interface for dealing with a specific CertificationAuthority.
31  *
32  * @version $Rev: 476291 $ $Date: 2006-11-17 15:05:24 -0500 (Fri, 17 Nov 2006) $
33  */

34 public interface CertificationAuthority {
35
36     /**
37      * This method checks if the CA is locked.
38      * @return true if CA is locked, false otherwise.
39      */

40     public abstract boolean isLocked();
41
42     /**
43      * This method locks the CA.
44      */

45     public abstract void lock();
46
47     /**
48      * This method unlocks the CA.
49      * @param password Password to unlock the CA.
50      */

51     public abstract void unlock(char[] password) throws CertificationAuthorityException;
52
53     /**
54      * This method returns CA's name.
55      * @throws Exception if CA is locked.
56      */

57     public abstract X500Principal JavaDoc getName() throws CertificationAuthorityException;
58
59     /**
60      * This method returns CA's own certificate.
61      * @throws Exception if CA is locked.
62      */

63     public abstract Certificate JavaDoc getCertificate() throws CertificationAuthorityException;
64
65     /**
66      * This method makes the CA issue a self-signed certificate with given details. This method is usually
67      * called while initializing the CA.
68      *
69      * @param sNo Serial number for self-signed certificate
70      * @param validFromDate Certificate validity period start date
71      * @param validToDate Certificate validity period end date
72      * @param algorithm Signature algorithm for self-signed certificate
73      */

74     public abstract void issueOwnCertificate(BigInteger JavaDoc sNo, Date JavaDoc validFromDate, Date JavaDoc validToDate, String JavaDoc algorithm) throws CertificationAuthorityException;
75
76     /**
77      * This method issues a certificate.
78      *
79      * @param subject Subject name
80      * @param publicKey Subject's public key
81      * @param sNo Serial number for the certificate to be issued
82      * @param validFromDate Certificate validity period start date
83      * @param validToDate Certificate validity period end date
84      * @param algorithm Signature algorithm for the certificate
85      * @return newly issued certificate
86      */

87     public abstract Certificate JavaDoc issueCertificate(X500Principal JavaDoc subject, PublicKey JavaDoc publicKey, BigInteger JavaDoc sNo, Date JavaDoc validFromDate, Date JavaDoc validToDate, String JavaDoc algorithm) throws CertificationAuthorityException;
88
89     /**
90      * This method returns the highest serial number used by the CA.
91      */

92     public abstract BigInteger JavaDoc getHighestSerialNumber() throws CertificationAuthorityException;
93
94     /**
95      * This method checks if a Certificate with a given serial number is already issued.
96      * @param sNo The serial number of the the certificate to be looked for
97      * @return true if a certificate with the specified serial number has already been issued
98      */

99     public abstract boolean isCertificateIssued(BigInteger JavaDoc sNo) throws CertificationAuthorityException;
100
101     /**
102      * This method returns the next serial number that can be used to issue a certificate and increments the
103      * highest serial number.
104      */

105     public abstract BigInteger JavaDoc getNextSerialNumber() throws CertificationAuthorityException;
106
107     /**
108      * This method retrieves a certificate with the specified serial number.
109      * @param sNo The serial number of the certificate to be retrieved
110      * @return java.security.cert.Certificate instance of the certificate
111      */

112     public abstract Certificate JavaDoc getCertificate(BigInteger JavaDoc sNo) throws CertificationAuthorityException;
113
114     /**
115      * This method retrieves a certificate with the specified serial number.
116      * @param sNo The serial number of the certificate to be retrieved
117      * @return base64 encoded certificate text
118      */

119     public abstract String JavaDoc getCertificateBase64Text(BigInteger JavaDoc sNo) throws CertificationAuthorityException;
120 }
121
Popular Tags