View Javadoc

1   /*
2    * $Id: TlsDirectKeyStore.java 22503 2011-07-21 14:46:28Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.api.security;
12  
13  import java.io.IOException;
14  
15  import javax.net.ssl.KeyManagerFactory;
16  
17  /**
18   * Configure direct key stores.
19   * TLS/SSL connections are made on behalf of an entity, which can be anonymous or identified by a
20   * certificate - this interface specifies how a keystore can be used to provide the certificates
21   * (and associated private keys) necessary for identification.
22   *
23   * <p>The information specified in this interface is used to configure a key store directly.
24   * For more information see the documentation for the connector or protocol in question.
25   * The comments in {@link org.mule.api.security.tls.TlsConfiguration} may also be useful.</p>
26   */
27  public interface TlsDirectKeyStore
28  {
29      /**
30       * @return The location (resolved relative to the current classpath and file system, if possible)
31       * of the keystore that contains public certificates and private keys for identification.
32       */
33      String getKeyStore();
34  
35      /**
36       * @param name The location of the keystore that contains public certificates  and private keys
37       * for identification.
38       * @throws IOException If the location cannot be resolved via the file system or classpath
39       */
40      void setKeyStore(String name) throws IOException;
41  
42      /**
43       * @return The alias of the key from the key store.
44       */
45      String getKeyAlias();
46  
47      /**
48       * @param alias of the key from the key store.
49       */
50      void setKeyAlias(String alias);
51  
52      /**
53       * @return The password used to protect the private key(s)
54       */
55      String getKeyPassword();
56  
57      /**
58       * @param keyPassword The password used to protect the private key(s)
59       */
60      void setKeyPassword(String keyPassword);
61  
62      /**
63       * @return The password used to protect the keystore itself
64       */
65      String getKeyStorePassword();
66  
67      /**
68       * @param storePassword The password used to protect the keystore itself
69       */
70      void setKeyStorePassword(String storePassword);
71  
72      /**
73       * @return The type of keystore used in {@link #getKeyStore()}
74       */
75      String getKeyStoreType();
76  
77      /**
78       * @param keystoreType The type of keystore used in {@link #setKeyStore(String)}
79       */
80      void setKeyStoreType(String keystoreType);
81  
82      /**
83       * @return The algorithm used by the key store.  The default comes from {
84       * @link org.mule.api.security.provider.AutoDiscoverySecurityProviderFactory}
85       */
86      String getKeyManagerAlgorithm();
87  
88      /**
89       * @param keyManagerAlgorithm The algorithm used by the key store.  The default comes from {
90       * @link org.mule.api.security.provider.AutoDiscoverySecurityProviderFactory}
91       */
92      void setKeyManagerAlgorithm(String keyManagerAlgorithm);
93  
94      /**
95       * @return A source of key stores generated from the parameters supplied here.
96       */
97      KeyManagerFactory getKeyManagerFactory();
98  }
99  
100