FileDocCategorySizeDatePackage
MyKeyStore.javaAPI DocAndroid 1.5 API7570Wed May 06 22:41:06 BST 2009org.apache.harmony.security.tests.support

MyKeyStore

public class MyKeyStore extends KeyStoreSpi
Additional class for KeyStoreSpi and KeyStore verification

Fields Summary
private Hashtable
Keys
private Hashtable
Cert
private Hashtable
Chain
private Hashtable
Dates
private Hashtable
KeysSL
private Hashtable
CertSL
private Hashtable
ChainSL
private Hashtable
DatesSL
Constructors Summary
Methods Summary
public java.util.EnumerationengineAliases()

        return null;
    
public booleanengineContainsAlias(java.lang.String alias)

        if (Keys.containsKey(alias)) {
            return true;
        }
        if (Cert.containsKey(alias)) {
            return true;
        }
        return false;
    
public voidengineDeleteEntry(java.lang.String alias)

        if (Keys.containsKey(alias)) {
            Keys.remove(alias);
            Chain.remove(alias);
            return;
        }
        if (Cert.containsKey(alias)) {
            Cert.remove(alias);
        }
    
public java.security.cert.CertificateengineGetCertificate(java.lang.String alias)

        if (Cert.containsKey(alias)) {
            return (Certificate) Cert.get(alias);
        }
        return null;
    
public java.lang.StringengineGetCertificateAlias(java.security.cert.Certificate cert)

        return "";
    
public java.security.cert.Certificate[]engineGetCertificateChain(java.lang.String alias)

        if (Chain.containsKey(alias)) {
            return (Certificate[]) Chain.get(alias);
        }
        return null;
    
public java.util.DateengineGetCreationDate(java.lang.String alias)

        if (Dates.containsKey(alias)) {
            return (Date) Dates.get(alias);
        }
        return null;
    
public java.security.KeyengineGetKey(java.lang.String alias, char[] password)


         
               
        if (Keys.containsKey(alias)) {
            return (Key) Keys.get(alias);
        }
        return null;
    
public booleanengineIsCertificateEntry(java.lang.String alias)

        if (Cert.containsKey(alias)) {
            return true;
        }
        return false;
    
public booleanengineIsKeyEntry(java.lang.String alias)

        if (Keys.containsKey(alias)) {
            return true;
        }
        return false;
    
public voidengineLoad(java.io.InputStream stream, char[] password)

        Keys.clear();
        Cert.clear();
        Chain.clear();
        Dates.clear();
        String alias;
        Enumeration e = KeysSL.keys();
        while (e.hasMoreElements()) {
            alias = (String) e.nextElement();
            Keys.put(alias, KeysSL.get(alias));
            Dates.put(alias, DatesSL.get(alias));
            if (ChainSL.containsKey(alias)) {
                Chain.put(alias, ChainSL.get(alias));
            }
        }
        e = CertSL.keys();
        while (e.hasMoreElements()) {
            alias = (String) e.nextElement();
            Cert.put(alias, CertSL.get(alias));
            Dates.put(alias, DatesSL.get(alias));
        }
    
public voidengineLoad(java.security.KeyStore$LoadStoreParameter param)

        if (!(param instanceof MyLoadStoreParams)) {
            throw new IllegalArgumentException("param is not MyLoadStoreParams: " + param);
        }
    
public voidengineSetCertificateEntry(java.lang.String alias, java.security.cert.Certificate cert)

        Cert.put(alias, cert);
        Dates.put(alias, new Date());
    
public voidengineSetKeyEntry(java.lang.String alias, java.security.Key key, char[] password, java.security.cert.Certificate[] chain)

        if (Cert.containsKey(alias)) {
            Cert.remove(alias);
        }
        Keys.put(alias, key);
        if (chain != null) {
            Chain.put(alias, chain);
        }
        Dates.put(alias, new Date());
    
public voidengineSetKeyEntry(java.lang.String alias, byte[] key, java.security.cert.Certificate[] chain)

        if (key == null) {
            throw new KeyStoreException("Not Supported for null key");
        }
        if (Cert.containsKey(alias)) {
            Cert.remove(alias);
        }
        if (Chain.containsKey(alias)) {
            Chain.remove(alias);
        }
        KeyStoreTestSupport.MyPrivateKey keyK = new KeyStoreTestSupport.MyPrivateKey(
                alias, alias, key);
        Keys.put(alias, keyK);
        if (chain != null) {
            Chain.put(alias, chain);
        }
        Dates.put(alias, new Date());

    
public intengineSize()

        return (Keys.size() + Cert.size());
    
public voidengineStore(java.io.OutputStream stream, char[] password)

        if (!(stream instanceof ByteArrayOutputStream)) {
            throw new IOException("Incorrect stream");
        }
        String alias;
        Enumeration e = Keys.keys();
        while (e.hasMoreElements()) {
            alias = (String) e.nextElement();
            KeysSL.put(alias, Keys.get(alias));
            DatesSL.put(alias, Dates.get(alias));
            if (Chain.containsKey(alias)) {
                ChainSL.put(alias, Chain.get(alias));
            }
        }
        e = Cert.keys();
        while (e.hasMoreElements()) {
            alias = (String) e.nextElement();
            CertSL.put(alias, Cert.get(alias));
            DatesSL.put(alias, Dates.get(alias));
        }
    
public voidengineStore(java.security.KeyStore$LoadStoreParameter param)

        if (param == null) {
            throw new IOException("param is null");
        }