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