Search in sources :

Example 11 with UserCertStore

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

the class CertImportController method validateAndReloadPlatformSource.

private void validateAndReloadPlatformSource() {
    try {
        PlatformKeyStore platformSource = validatePlatformSourceInput();
        getExecutorService().submit(new ReloadTask<PlatformKeyStore>(platformSource) {

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

Example 12 with UserCertStore

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

the class CertImportController method importSelection.

void importSelection(Set<UserCertStoreEntry> importSelection) throws IOException {
    PasswordCallback newPassword = PasswordDialog.enterNewPassword(this);
    UserCertStore importStore = this.importStoreParam.get();
    for (UserCertStoreEntry importEntry : importSelection) {
        importStore.importEntry(importEntry, newPassword, CertImportI18N.formatSTR_TEXT_ALIASHINT());
    }
}
Also used : PasswordCallback(de.carne.certmgr.certs.PasswordCallback) UserCertStore(de.carne.certmgr.certs.UserCertStore) UserCertStoreEntry(de.carne.certmgr.certs.UserCertStoreEntry)

Example 13 with UserCertStore

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

the class CertImportController method updateImportEntryView.

private void updateImportEntryView() {
    this.lazyImportEntryViewHelper.get().update(this.sourceStore);
    UserCertStore checkedSourceStore = this.sourceStore;
    if (checkedSourceStore != null) {
        this.ctlStatusMessage.setText(CertImportI18N.formatSTR_STATUS_NEW_STORE(checkedSourceStore.size()));
        this.ctlStatusImage.setImage(Images.OK16);
    } else {
        this.ctlStatusMessage.setText(CertImportI18N.formatSTR_STATUS_NO_STORE());
        this.ctlStatusImage.setImage(Images.WARNING16);
    }
    this.ctlSelectAllOption.setSelected(false);
}
Also used : UserCertStore(de.carne.certmgr.certs.UserCertStore)

Example 14 with UserCertStore

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

the class StoreController method onCmdNewCert.

@SuppressWarnings("unused")
@FXML
void onCmdNewCert(ActionEvent evt) {
    UserCertStore store = this.storeProperty.get();
    if (store != null) {
        try {
            CertOptionsController certOptions = loadStage(CertOptionsController.class).init(store, getSelectedStoreEntry(), this.userPreferences.expertMode.getBoolean(false));
            certOptions.showAndWait();
            updateStoreEntryView();
        } catch (IOException e) {
            Alerts.unexpected(e).showAndWait();
        }
    }
}
Also used : CertOptionsController(de.carne.certmgr.jfx.certoptions.CertOptionsController) IOException(java.io.IOException) UserCertStore(de.carne.certmgr.certs.UserCertStore) FXML(javafx.fxml.FXML)

Example 15 with UserCertStore

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

the class UserCertStoreTest method testURLSourceStore.

/**
 * Test store creation from URL source.
 */
@Test
public void testURLSourceStore() {
    try {
        UserCertStore importStore = UserCertStore.createFromURL(TestCerts.simplePKCS12URL(), TestCerts.password());
        Assert.assertNotNull(importStore);
        Assert.assertTrue(importStore.size() > 0);
    } catch (IOException e) {
        e.printStackTrace();
        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