/*
 * JBoss, Home of Professional Open Source
 * Copyright 2005, JBoss Inc., and individual contributors as indicated
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.jboss.security.plugins;

import java.io.IOException;
import javax.management.ObjectName;
import javax.crypto.Cipher;

import org.jboss.system.ServiceMBean;


/** The JaasSecurityDomainMBean adds support for KeyStore management.

 @author Scott.Stark@jboss.org
 @version $Revision: 1.4.2.3 $
*/
public interface JaasSecurityDomainMBean extends ServiceMBean
{
   /** KeyStore implementation type being used.
    @return the KeyStore implementation type being used.
    */
   public String getKeyStoreType();
   /** Set the type of KeyStore implementation to use. This is
    passed to the KeyStore.getInstance() factory method.
    */
   public void setKeyStoreType(String type);
   /** Get the KeyStore database URL string.
    */
   public String getKeyStoreURL();
   /** Set the KeyStore database URL string. This is used to obtain
    an InputStream to initialize the KeyStore.
    */
   public void setKeyStoreURL(String storeURL) throws IOException;
    /** Set the credential string for the KeyStore.
    */
   public void setKeyStorePass(String password);
   /** 
        Reload the Keystore.
   */
   public void reloadKeyStore() throws Exception;
   /** The JMX object name string of the security manager service.
    @return The JMX object name string of the security manager service.
    */
   public ObjectName getManagerServiceName();
   /** Set the JMX object name string of the security manager service.
    */
   public void setManagerServiceName(ObjectName jmxName);
   /** A flag indicating if the Sun com.sun.net.ssl.internal.ssl.Provider 
    security provider should be loaded on startup. This is needed when using
    the Sun JSSE jars without them installed as an extension with JDK 1.3. This
    should be set to false with JDK 1.4 or when using an alternate JSSE provider
    */
   public boolean getLoadSunJSSEProvider();

   /** A flag indicating if the Sun com.sun.net.ssl.internal.ssl.Provider 
    security provider should be loaded on startup. This is needed when using
    the Sun JSSE jars without them installed as an extension with JDK 1.3. This
    should be set to false with JDK 1.4 or when using an alternate JSSE provider
    */
   public void setLoadSunJSSEProvider(boolean flag);

   public void setSalt(String salt);
   public void setIterationCount(int count);

   public byte[] encode(byte[] secret)
      throws Exception;

   public byte[] decode(byte[] secret)
      throws Exception;

   public String encode64(byte[] secret)
      throws Exception;

   public byte[] decode64(String secret)
      throws Exception;
}
