4d6fa87d7ef469393251fa92264e957a6e2ef2f3
[openflowjava.git] / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / connection / TlsConfigurationImpl.java
1 /*\r
2  * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 \r
9 package org.opendaylight.openflowjava.protocol.api.connection;\r
10 \r
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;\r
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;\r
13 \r
14 /**\r
15  * Class is used only for testing purposes - passwords are hardcoded\r
16  * @author michal.polkorab\r
17  */\r
18 public class TlsConfigurationImpl implements TlsConfiguration {\r
19 \r
20     private KeystoreType trustStoreType;\r
21     private String trustStore;\r
22     private KeystoreType keyStoreType;\r
23     private String keyStore;\r
24     private PathType keystorePathType;\r
25     private PathType truststorePathType;\r
26 \r
27     /**\r
28      * Default constructor\r
29      * @param trustStoreType JKS or PKCS12\r
30      * @param trustStore path to trustStore file\r
31      * @param trustStorePathType truststore path type (classpath or path)\r
32      * @param keyStoreType JKS or PKCS12\r
33      * @param keyStore path to keyStore file\r
34      * @param keyStorePathType keystore path type (classpath or path)\r
35      */\r
36     public TlsConfigurationImpl(KeystoreType trustStoreType, String trustStore,\r
37             PathType trustStorePathType, KeystoreType keyStoreType,\r
38             String keyStore, PathType keyStorePathType) {\r
39         this.trustStoreType = trustStoreType;\r
40         this.trustStore = trustStore;\r
41         this.truststorePathType = trustStorePathType;\r
42         this.keyStoreType = keyStoreType;\r
43         this.keyStore = keyStore;\r
44         this.keystorePathType = keyStorePathType;\r
45     }\r
46 \r
47     @Override\r
48     public KeystoreType getTlsTruststoreType() {\r
49         return trustStoreType;\r
50     }\r
51 \r
52     @Override\r
53     public String getTlsTruststore() {\r
54         return trustStore;\r
55     }\r
56 \r
57     @Override\r
58     public KeystoreType getTlsKeystoreType() {\r
59         return keyStoreType;\r
60     }\r
61 \r
62     @Override\r
63     public String getTlsKeystore() {\r
64         return keyStore;\r
65     }\r
66 \r
67     @Override\r
68     public PathType getTlsKeystorePathType() {\r
69         return keystorePathType;\r
70     }\r
71 \r
72     @Override\r
73     public PathType getTlsTruststorePathType() {\r
74         return truststorePathType;\r
75     }\r
76 \r
77     @Override\r
78     public String getKeystorePassword() {\r
79         return "opendaylight";\r
80     }\r
81 \r
82     @Override\r
83     public String getCertificatePassword() {\r
84         return "opendaylight";\r
85     }\r
86 \r
87     @Override\r
88     public String getTruststorePassword() {\r
89         return "opendaylight";\r
90     }\r
91 }\r