Search in sources :

Example 6 with UserCertStore

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

the class UserCertStoreTest method testPlatformKeyStoreSourceStore.

/**
 * Test store creation from platform key stores.
 */
@Test
public void testPlatformKeyStoreSourceStore() {
    try {
        DefaultSet<PlatformKeyStore> platformKeyStores = PlatformKeyStore.getDefaultSet();
        for (PlatformKeyStore platformKeyStore : platformKeyStores) {
            UserCertStore importStore = UserCertStore.createFromPlatformKeyStore(platformKeyStore, NoPassword.getInstance());
            traverseStore(importStore.getEntries());
        }
    } catch (IOException e) {
        e.printStackTrace();
        Assert.fail(e.getMessage());
    }
}
Also used : PlatformKeyStore(de.carne.certmgr.certs.security.PlatformKeyStore) IOException(java.io.IOException) UserCertStore(de.carne.certmgr.certs.UserCertStore) Test(org.junit.Test)

Example 7 with UserCertStore

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

the class CertOptionsController method generateEntry.

void generateEntry(CertGenerator generator, GenerateCertRequest generateRequest, String alias) throws IOException {
    UserCertStore store = this.storeParam.get();
    store.generateEntry(generator, generateRequest, PasswordDialog.enterPassword(this), PasswordDialog.enterNewPassword(this), alias);
}
Also used : UserCertStore(de.carne.certmgr.certs.UserCertStore)

Example 8 with UserCertStore

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

the class CertOptionsController method initCertificateNames.

private void initCertificateNames() {
    UserCertStore store = this.storeParam.get();
    UserCertStoreEntryId entryId = store.generateEntryId(CertOptionsI18N.formatSTR_TEXT_ALIASHINT());
    this.ctlAliasInput.setText(entryId.getAlias());
    String serial = CertOptionsTemplates.defaultSerial();
    this.ctlDNInput.setText(CertOptionsTemplates.defaultDNInput(entryId.getAlias(), Check.notNull(store.storeName()), serial));
}
Also used : UserCertStoreEntryId(de.carne.certmgr.certs.UserCertStoreEntryId) UserCertStore(de.carne.certmgr.certs.UserCertStore)

Example 9 with UserCertStore

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

the class CertImportController method validateAndReloadDirectorySource.

private void validateAndReloadDirectorySource() {
    try {
        Path directorySource = validateDirectorySourceInput();
        getExecutorService().submit(new ReloadTask<Path>(directorySource) {

            @Override
            protected UserCertStore createStore(Path params) throws IOException {
                List<Path> files;
                try (Stream<Path> filesStream = Files.walk(params)) {
                    files = filesStream.filter(Files::isRegularFile).collect(Collectors.toList());
                }
                return UserCertStore.createFromFiles(files, PasswordDialog.enterPassword(CertImportController.this));
            }
        });
    } catch (ValidationException e) {
        ValidationAlerts.error(e).showAndWait();
    }
}
Also used : Path(java.nio.file.Path) ValidationException(de.carne.jfx.util.validation.ValidationException) List(java.util.List) ArrayList(java.util.ArrayList) Stream(java.util.stream.Stream) IOException(java.io.IOException) UserCertStore(de.carne.certmgr.certs.UserCertStore)

Example 10 with UserCertStore

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

the class CertImportController method validateAndReloadURLSource.

private void validateAndReloadURLSource() {
    try {
        URL urlSource = validateURLSourceInput();
        getExecutorService().submit(new ReloadTask<URL>(urlSource) {

            @Override
            protected UserCertStore createStore(URL params) throws IOException {
                return UserCertStore.createFromURL(params, PasswordDialog.enterPassword(CertImportController.this));
            }
        });
    } catch (ValidationException e) {
        ValidationAlerts.error(e).showAndWait();
    }
}
Also used : ValidationException(de.carne.jfx.util.validation.ValidationException) IOException(java.io.IOException) URL(java.net.URL) UserCertStore(de.carne.certmgr.certs.UserCertStore)

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