1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */
22 package org.jboss.security.plugins;
23
24 import java.io.IOException;
25 import javax.management.ObjectName;
26 import org.jboss.system.ServiceMBean;
27
28
29 /** The JaasSecurityDomainMBean adds support for KeyStore management.
30
31 @author Scott.Stark@jboss.org
32 @author <a href="mailto:jasone@greenrivercomputing.com">Jason Essington</a>
33 @version $Revision: 37459 $
34 */
35 public interface JaasSecurityDomainMBean extends ServiceMBean
36 {
37 /** KeyStore implementation type being used.
38 @return the KeyStore implementation type being used.
39 */
40 public String getKeyStoreType();
41 /** Set the type of KeyStore implementation to use. This is
42 passed to the KeyStore.getInstance() factory method.
43 */
44 public void setKeyStoreType(String type);
45 /** Get the KeyStore database URL string.
46 */
47 public String getKeyStoreURL();
48 /** Set the KeyStore database URL string. This is used to obtain
49 an InputStream to initialize the KeyStore.
50 */
51 public void setKeyStoreURL(String storeURL) throws IOException;
52 /** Set the credential string for the KeyStore.
53 */
54 public void setKeyStorePass(String password) throws Exception;
55
56 /** Get the type of the trust store
57 * @return the type of the trust store
58 */
59 public String getTrustStoreType();
60 /** Set the type of the trust store
61 * @param type - the trust store implementation type
62 */
63 public void setTrustStoreType(String type);
64 /** Set the credential string for the trust store.
65 */
66 public void setTrustStorePass(String password) throws Exception;
67 /** Get the trust store database URL string.
68 */
69 public String getTrustStoreURL();
70 /** Set the trust store database URL string. This is used to obtain
71 an InputStream to initialize the trust store.
72 */
73 public void setTrustStoreURL(String storeURL) throws IOException;
74 /**
75 Reload the key- and truststore
76 */
77 public void reloadKeyAndTrustStore() throws Exception;
78 /** The JMX object name string of the security manager service.
79 @return The JMX object name string of the security manager service.
80 */
81 public ObjectName getManagerServiceName();
82 /** Set the JMX object name string of the security manager service.
83 */
84 public void setManagerServiceName(ObjectName jmxName);
85
86 /** Set the salt used with PBE based on the keystore password.
87 * @param salt - an 8 char randomization string
88 */
89 public void setSalt(String salt);
90 /** Set the iteration count used with PBE based on the keystore password.
91 * @param count - an iteration count randomization value
92 */
93 public void setIterationCount(int count);
94
95 /** Encode a secret using the keystore password and PBEwithMD5andDES algo
96 * @param secret - the byte sequence to encrypt
97 * @return the encrypted byte sequence
98 * @throws Exception
99 */
100 public byte[] encode(byte[] secret)
101 throws Exception;
102
103 /** Decode a secret using the keystore password and PBEwithMD5andDES algo
104 * @param secret - the byte sequence to decrypt
105 * @return the decrypted byte sequence
106 * @throws Exception
107 */
108 public byte[] decode(byte[] secret)
109 throws Exception;
110
111 /** Encode a secret using the keystore password and PBEwithMD5andDES algo
112 * @param secret - the byte sequence to encrypt as a base64 string using
113 * the Util.tob64() function
114 * @return the encrypted byte sequence
115 * @throws Exception
116 */
117 public String encode64(byte[] secret)
118 throws Exception;
119
120 /** Decode a secret using the keystore password and PBEwithMD5andDES algo
121 * @param secret - the Util.tob64 string represention to decrypt
122 * @return the decrypted byte sequence
123 * @throws Exception
124 */
125 public byte[] decode64(String secret)
126 throws Exception;
127 }