Code example for KeyStore

Methods: containsAlias, getCertificate, getCertificateAlias, getCertificateChain, getCreationDate, getKey, isCertificateEntry, isKeyEntry, load, size

    private void checkResult(KeyStore keyS) throws KeyStoreException,
            IOException, CertificateException, NoSuchAlgorithmException, 
            UnrecoverableKeyException { 
        char[] pass = { 'a', 'b', 'c' };
        String alias = "aaa";        
        keyS.load(null, pass);
        assertNull("getKey must return null", keyS.getKey(alias, pass));
        assertNull("getCertificate must return null", keyS
        assertNull("getCertificateChain must return null", keyS
        assertEquals("Incorrect result of getCreationDate", keyS
                .getCreationDate(alias), new Date(0));
        assertEquals("Incorrect result of size", keyS.size(), 0);
        assertFalse("Incorrect result of isCertificateEntry", keyS
        assertFalse("Incorrect result of isKeyEntry", keyS.isKeyEntry(alias));
        assertFalse("Incorrect result of containsAlias", keyS
        assertEquals("Incorrect result of getCertificateAlias", keyS
                .getCertificateAlias(null), "");
        try { 
            keyS.setCertificateEntry(alias, null);
            fail("KeyStoreException must be thrown because this method is not supported");
        } catch (KeyStoreException e) {