core.model
Class KeyStoreProvider

java.lang.Object
  extended by java.util.Observable
      extended by core.model.KeyStoreProvider

public class KeyStoreProvider
extends Observable

  Copyright (c) 2006 Sebastian Erdweg
  Copyright (c) 2006 Dominik Schulz
  Copyright (c) 2006 Florian Lindner
  Copyright (c) 2006 Betim Berjani
  
  This file is part of FlexiCrypt.

  FlexiCrypt is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  FlexiCrypt 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 General Public License for more details.
  
  You should have received a copy of the GNU General Public License
  along with FlexiCrypt; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  

Author:
Sebastian, Dominik

Field Summary
static int ACCESS_UPDATE
           
static int ASYMMETRIC_ALGO_UPDATE
           
static Provider[] DEFAULTPROVIDERS
           
static int DIGEST_ALGO_UPDATE
           
static int KEY_UPDATE
           
static FileFilter KEYSTOREFILEFILTER
           
static int SIGNATURE_ALGO_UPDATE
           
static int SYMMETRIC_ALGO_UPDATE
           
 
Method Summary
 void addCrl(X509Crl crl)
           
 boolean containsEntry(String alias)
           
 void create()
           
 void discard()
           
 String getAlias(KeyStore.Entry e)
           
 Enumeration<String> getAllAliases()
           
 Collection<KeyStore.Entry> getAllEntries()
           
 HashMap<String,Set<Integer>> getAsymmAlgosWithStrenths()
           
 ArrayList<X509Crl> getCrls()
           
 Set<String> getDigestAlgos()
           
 KeyStore.Entry getEntry(String alias)
           
static KeyStoreProvider getInstance()
           
 KeyStore.PrivateKeyEntry getPrivateKeyEntryByCertificateId(BigInteger id)
          Searches for a PrivateKeyEntry with a given Certificate ID
 ArrayList<BigInteger> getRevokedSerials()
           
 Set<String> getSignAlgos()
           
 HashMap<String,Set<Integer>> getSymmAlgosWithStrenths()
           
 KeyStore.TrustedCertificateEntry getTrustedCertificateEntryByCertificateId(BigInteger id)
          Searches for a TrustedCertificateEntry with a given Certificate ID
 void insertEntry(String alias, KeyStore.Entry entry)
           
 boolean isLoaded()
           
 boolean isReadOnly()
           
 void load(File f, char[] password)
           
 void refreshAlgoDataBase()
           
 void removeAllEntries()
           
 void removeCrl(X509Crl crl)
           
 void removeEntry(String alias)
           
 void save(File f, char[] password)
           
 void setAsymmAlgosWithStrenths(HashMap<String,Set<Integer>> asymmAlgosWithStrenths)
           
 void setDigestAlgos(Set<String> digestAlgos)
           
 void setReadOnly(boolean readOnly)
           
 void setSignAlgos(Set<String> signAlgos)
           
 void setSymmAlgosWithStrenths(HashMap<String,Set<Integer>> symmAlgosWithStrenths)
           
 void updateEntry(String alias, KeyStore.Entry entry)
           
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_UPDATE

public static final int KEY_UPDATE
See Also:
Constant Field Values

ACCESS_UPDATE

public static final int ACCESS_UPDATE
See Also:
Constant Field Values

ASYMMETRIC_ALGO_UPDATE

public static final int ASYMMETRIC_ALGO_UPDATE
See Also:
Constant Field Values

SYMMETRIC_ALGO_UPDATE

public static final int SYMMETRIC_ALGO_UPDATE
See Also:
Constant Field Values

DIGEST_ALGO_UPDATE

public static final int DIGEST_ALGO_UPDATE
See Also:
Constant Field Values

SIGNATURE_ALGO_UPDATE

public static final int SIGNATURE_ALGO_UPDATE
See Also:
Constant Field Values

DEFAULTPROVIDERS

public static final Provider[] DEFAULTPROVIDERS

KEYSTOREFILEFILTER

public static final FileFilter KEYSTOREFILEFILTER
Method Detail

refreshAlgoDataBase

public void refreshAlgoDataBase()

getDigestAlgos

public Set<String> getDigestAlgos()
Returns:
the digestAlgos

setDigestAlgos

public void setDigestAlgos(Set<String> digestAlgos)
Parameters:
digestAlgos - the digestAlgos to set

getSignAlgos

public Set<String> getSignAlgos()
Returns:
the signAlgos

setSignAlgos

public void setSignAlgos(Set<String> signAlgos)
Parameters:
signAlgos - the signAlgos to set

getAsymmAlgosWithStrenths

public HashMap<String,Set<Integer>> getAsymmAlgosWithStrenths()
Returns:
the asymmAlgosWithStrenths

setAsymmAlgosWithStrenths

public void setAsymmAlgosWithStrenths(HashMap<String,Set<Integer>> asymmAlgosWithStrenths)
Parameters:
asymmAlgosWithStrenths - the asymmAlgosWithStrenths to set

getSymmAlgosWithStrenths

public HashMap<String,Set<Integer>> getSymmAlgosWithStrenths()
Returns:
the symmAlgosWithStrenths

setSymmAlgosWithStrenths

public void setSymmAlgosWithStrenths(HashMap<String,Set<Integer>> symmAlgosWithStrenths)
Parameters:
symmAlgosWithStrenths - the symmAlgosWithStrenths to set

getInstance

public static KeyStoreProvider getInstance()

create

public void create()
            throws Exception
Throws:
Exception

isLoaded

public boolean isLoaded()

load

public void load(File f,
                 char[] password)
          throws Exception
Throws:
Exception

save

public void save(File f,
                 char[] password)
          throws Exception
Throws:
Exception

discard

public void discard()

containsEntry

public boolean containsEntry(String alias)
                      throws Exception
Throws:
Exception

getEntry

public KeyStore.Entry getEntry(String alias)
                        throws Exception
Throws:
Exception

getAlias

public String getAlias(KeyStore.Entry e)
                throws Exception
Throws:
Exception

getPrivateKeyEntryByCertificateId

public KeyStore.PrivateKeyEntry getPrivateKeyEntryByCertificateId(BigInteger id)
                                                           throws Exception
Searches for a PrivateKeyEntry with a given Certificate ID

Parameters:
id -
Returns:
a KeyStore.Entry
Throws:
Exception

getTrustedCertificateEntryByCertificateId

public KeyStore.TrustedCertificateEntry getTrustedCertificateEntryByCertificateId(BigInteger id)
                                                                           throws Exception
Searches for a TrustedCertificateEntry with a given Certificate ID

Parameters:
id -
Returns:
a KeyStore.Entry
Throws:
Exception

insertEntry

public void insertEntry(String alias,
                        KeyStore.Entry entry)
                 throws Exception
Throws:
Exception

removeEntry

public void removeEntry(String alias)
                 throws Exception
Throws:
Exception

removeAllEntries

public void removeAllEntries()
                      throws Exception
Throws:
Exception

updateEntry

public void updateEntry(String alias,
                        KeyStore.Entry entry)
                 throws Exception
Throws:
Exception

getAllEntries

public Collection<KeyStore.Entry> getAllEntries()
                                         throws Exception
Throws:
Exception

getAllAliases

public Enumeration<String> getAllAliases()
                                  throws Exception
Throws:
Exception

isReadOnly

public boolean isReadOnly()

setReadOnly

public void setReadOnly(boolean readOnly)

addCrl

public void addCrl(X509Crl crl)

removeCrl

public void removeCrl(X509Crl crl)

getCrls

public ArrayList<X509Crl> getCrls()

getRevokedSerials

public ArrayList<BigInteger> getRevokedSerials()