Search in sources :

Example 16 with UserCertStore

use of de.carne.certmgr.certs.UserCertStore in project certmgr by hdecarne.

the class UserCertStoreTest method testFilesSourceStore.

/**
 * Test store creation from file list source.
 */
@Test
public void testFilesSourceStore() {
    try {
        List<Path> files = collectDirectoryFiles(testStorePath.get());
        UserCertStore importStore = UserCertStore.createFromFiles(files, TestCerts.password());
        Assert.assertNotNull(importStore);
        Assert.assertTrue(importStore.size() > 0);
    } catch (IOException e) {
        e.printStackTrace();
        Assert.fail(e.getMessage());
    }
}
Also used : Path(java.nio.file.Path) IOException(java.io.IOException) UserCertStore(de.carne.certmgr.certs.UserCertStore) Test(org.junit.Test)

Example 17 with UserCertStore

use of de.carne.certmgr.certs.UserCertStore in project certmgr by hdecarne.

the class UserCertStoreTest method testServerSourceStore.

/**
 * Test store creation from server source.
 */
@Test
public void testServerSourceStore() {
    try {
        UserCertStore importStore = UserCertStore.createFromServer(Protocol.SSL, TEST_SSL_HOST, TEST_SSL_PORT);
        Assert.assertNotNull(importStore);
        Assert.assertTrue(importStore.size() > 0);
    } catch (IOException e) {
        e.printStackTrace();
        Assert.fail(e.getMessage());
    }
    try {
        UserCertStore importStore = UserCertStore.createFromServer(Protocol.STARTTLS_SMTP, TEST_SMTP_HOST, TEST_SMTP_PORT);
        Assert.assertNotNull(importStore);
        Assert.assertTrue(importStore.size() > 0);
    } catch (IOException e) {
        e.printStackTrace();
        Assert.fail(e.getMessage());
    }
    try {
        UserCertStore importStore = UserCertStore.createFromServer(Protocol.STARTTLS_IMAP, TEST_IMAP_HOST, TEST_IMAP_PORT);
        Assert.assertNotNull(importStore);
        Assert.assertTrue(importStore.size() > 0);
    } catch (IOException e) {
        e.printStackTrace();
        Assert.fail(e.getMessage());
    }
    try {
        UserCertStore importStore = UserCertStore.createFromServer(Protocol.STARTTLS_SMTP, TEST_SSL_HOST, TEST_SSL_PORT);
        Assert.assertEquals(0, importStore.size());
    } catch (IOException e) {
        Assert.fail(e.getMessage());
    }
}
Also used : IOException(java.io.IOException) UserCertStore(de.carne.certmgr.certs.UserCertStore) Test(org.junit.Test)

Aggregations

UserCertStore (de.carne.certmgr.certs.UserCertStore)17 IOException (java.io.IOException)13 Test (org.junit.Test)6 ValidationException (de.carne.jfx.util.validation.ValidationException)5 Path (java.nio.file.Path)5 UserCertStoreEntry (de.carne.certmgr.certs.UserCertStoreEntry)4 PlatformKeyStore (de.carne.certmgr.certs.security.PlatformKeyStore)3 ArrayList (java.util.ArrayList)3 FXML (javafx.fxml.FXML)3 PasswordCallback (de.carne.certmgr.certs.PasswordCallback)2 UserCertStoreEntryId (de.carne.certmgr.certs.UserCertStoreEntryId)2 LogLevel (de.carne.boot.logging.LogLevel)1 LogRecorder (de.carne.boot.logging.LogRecorder)1 UserCertStorePreferences (de.carne.certmgr.certs.UserCertStorePreferences)1 CertReaders (de.carne.certmgr.certs.io.CertReaders)1 SSLPeer (de.carne.certmgr.certs.net.SSLPeer)1 SignatureAlgorithm (de.carne.certmgr.certs.security.SignatureAlgorithm)1 CertReader (de.carne.certmgr.certs.spi.CertReader)1 GenerateCertRequest (de.carne.certmgr.certs.x509.GenerateCertRequest)1 UpdateCRLRequest (de.carne.certmgr.certs.x509.UpdateCRLRequest)1