Add TLS protocol configuration
[aaa.git] / aaa-cert / src / main / java / org / opendaylight / aaa / cert / api / IAaaCertProvider.java
1 /*
2  * Copyright (c) 2015 Inocybe Technologies. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.aaa.cert.api;
10
11 import java.security.KeyStore;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.yang.aaa.cert.rev151126.aaa.cert.service.config.CtlKeystore;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.yang.aaa.cert.rev151126.aaa.cert.service.config.TrustKeystore;
15
16 /**
17  * IAaaCertProvider defines the basic operation for certificates management
18  *
19  * @author mserngawy
20  *
21  */
22 public interface IAaaCertProvider {
23
24     /**
25      * Add certificate to ODL keystore, the certificate should be signed by a CA (Certificate Authority) based on a certificate
26      * request generated by the ODL keystore.
27      *
28      * @param storePasswd ODL keystore password
29      * @param alias certificate alias
30      * @param certificate certificate @Nonnull String
31      * @return true at successful adding certificate
32      */
33     boolean addCertificateODLKeyStore(@Nonnull String storePasswd, @Nonnull String alias, @Nonnull String certificate);
34
35     /**
36      * Add certificate to ODL keystore, the certificate should be signed by a CA (Certificate Authority) based on a certificate
37      * request generated by the ODL keystore.
38      *
39      * @param alias certificate alias
40      * @param certificate certificate @Nonnull String
41      * @return true at successful adding certificate
42      */
43     boolean addCertificateODLKeyStore(@Nonnull String alias, @Nonnull String certificate);
44
45     /**
46      * Add certificate to Trust keystore.
47      *
48      * @param storePasswd ODL keystore password
49      * @param alias certificate alias
50      * @param certificate certificate @Nonnull String
51      * @return true at successful adding certificate
52      */
53     boolean addCertificateTrustStore(@Nonnull String storePasswd, @Nonnull String alias, @Nonnull String certificate);
54
55     /**
56      * Add certificate to Trust keystore.
57      *
58      * @param alias certificate alias
59      * @param certificate certificate @Nonnull String
60      * @return true if certificate was added successfully
61      */
62     boolean addCertificateTrustStore(@Nonnull String alias, @Nonnull String certificate);
63
64     /**
65      * Generate certificate request from the ODL keystore to be signed by a CA
66      *
67      * @param storePasswd ODL keystore password
68      * @param withTag return the certificate Req string with tag if true
69      * @return the certificate request
70      */
71     @Nonnull String genODLKeyStoreCertificateReq(@Nonnull String storePasswd, boolean withTag);
72
73     /**
74      * Generate certificate request from the ODL keystore to be signed by a CA
75      *
76      * @param withTag return the certificate Req string with tag if true
77      * @return the certificate request
78      */
79     @Nonnull String genODLKeyStoreCertificateReq(boolean withTag);
80
81     /**
82      * Get certificate from the Trust keystore
83      *
84      * @param storePasswd Trust keystore password
85      * @param alias the certificate alias
86      * @param withTag return the certificate string with tag if true
87      * @return the certificate
88      */
89     @Nonnull String getCertificateTrustStore(@Nonnull String storePasswd, @Nonnull String alias, boolean withTag);
90
91     /**
92      * Get certificate from the Trust keystore
93      *
94      * @param alias the certificate alias
95      * @param withTag return certificate string with tag if true
96      * @return the certificate
97      */
98     @Nonnull String getCertificateTrustStore(@Nonnull String alias, final boolean withTag);
99
100     /**
101      * Get ODL keystore certificate.
102      *
103      * @param storePasswd ODL keystore password
104      * @param withTag return certificate string with tag if true
105      * @return the certificate
106      */
107     @Nonnull String getODLKeyStoreCertificate(@Nonnull String storePasswd, boolean withTag);
108
109     /**
110      * Get ODL keystore certificate
111      *
112      * @param withTag return certificate string with tag if true
113      * @return the certificate
114      */
115     @Nonnull String getODLKeyStoreCertificate(boolean withTag);
116
117     /**
118      * Get ODL Keystore as java keystore object
119      *
120      * @return ODL keystore
121      */
122     KeyStore getODLKeyStore();
123
124     /**
125      * Get Trust Keystore as java keystore object
126      *
127      * @return Trust keystore
128      */
129     KeyStore getTrustKeyStore();
130
131     /**
132      * Get list of of the allowed cipher suites otherwise empty array
133      *
134      * @return Cipher suites
135      */
136     String[] getCipherSuites();
137
138     /**
139      * Get list of the supported TLS protocols
140      *
141      * @return TLS protocols
142      */
143     String[] getTlsProtocols();
144
145     /**
146      * Get the Trust key store Data
147      *
148      * @return Trust Keystore Object
149      */
150     TrustKeystore getTrustKeyStoreInfo();
151
152     /**
153      * Get the ODL key store Data
154      *
155      * @return Ctl Keystore Object
156      */
157     CtlKeystore getOdlKeyStoreInfo();
158
159     /**
160      * Create the ODL and Trust keystores based on the CtlKeystore and TrustKeystore data
161      *
162      * @return true if success
163      */
164     boolean createKeyStores();
165 }