BUG 2245 - Fixed Constant Name
[openflowjava.git] / simple-client / src / main / java / org / opendaylight / openflowjava / protocol / impl / clients / ClientSslTrustStore.java
1 /*
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. 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.openflowjava.protocol.impl.clients;
10
11 import java.io.InputStream;
12
13 /**
14  * Class for storing keys
15  *
16  * @author michal.polkorab
17  */
18 public final class ClientSslTrustStore {
19
20     private static final String KEY_STORE_FILENAME = "/selfSignedController";
21
22     private ClientSslTrustStore() {
23         throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
24     }
25
26     /**
27      * InputStream instance of key
28      *
29      * @return key as InputStream
30      */
31     public static InputStream asInputStream() {
32         InputStream in = ClientSslTrustStore.class.getResourceAsStream(KEY_STORE_FILENAME);
33         if (in == null) {
34             throw new IllegalStateException("KeyStore file not found: " + KEY_STORE_FILENAME);
35         }
36         return in;
37     }
38
39     /**
40      * @return certificate password as char[]
41      */
42     public static char[] getCertificatePassword() {
43         return "opendaylight".toCharArray();
44     }
45
46     /**
47      * @return KeyStore password as char[]
48      */
49     public static char[] getKeyStorePassword() {
50         return "opendaylight".toCharArray();
51     }
52 }