Copyright update
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / core / SslKeyStore.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.core;
10
11 import java.io.InputStream;
12
13 /**
14  * Class for storing keys
15  *
16  * @author michal.polkorab
17  */
18 public final class SslKeyStore {
19
20     private static final String filename = "/key.bin";
21
22     /**
23      * InputStream instance of key
24      *
25      * @return key as InputStream
26      */
27     public static InputStream asInputStream() {
28         InputStream in = SslKeyStore.class.getResourceAsStream(filename);
29         if (in == null) {
30             throw new IllegalStateException("KeyStore file not found: " + filename);
31         }
32         return in;
33     }
34
35     /**
36      * @return certificate password as char[]
37      */
38     public static char[] getCertificatePassword() {
39         return "secret".toCharArray();
40     }
41
42     /**
43      * @return KeyStore password as char[]
44      */
45     public static char[] getKeyStorePassword() {
46         return "secret".toCharArray();
47     }
48 }