Search in sources :

Example 6 with AbstractKeyNode

use of org.jcryptool.crypto.keystore.ui.views.nodes.keys.AbstractKeyNode in project core by jcryptool.

the class SecretKeyContainerNode method remove.

public void remove(IKeyStoreAlias alias) {
    AbstractKeyNode child = new SecretKeyNode(alias);
    // $NON-NLS-1$
    LogUtil.logInfo("nodes.length a priori: " + nodes.size());
    nodes.remove(child);
    // $NON-NLS-1$
    LogUtil.logInfo("nodes.length a posterior: " + nodes.size());
    removeChild(child);
    Iterator<IKeyStoreListener> it = ContactManager.getInstance().getKeyStoreListeners();
    while (it.hasNext()) {
        it.next().fireKeyStoreModified(this);
    }
}
Also used : AbstractKeyNode(org.jcryptool.crypto.keystore.ui.views.nodes.keys.AbstractKeyNode) SecretKeyNode(org.jcryptool.crypto.keystore.ui.views.nodes.keys.SecretKeyNode) IKeyStoreListener(org.jcryptool.crypto.keystore.ui.views.interfaces.IKeyStoreListener)

Example 7 with AbstractKeyNode

use of org.jcryptool.crypto.keystore.ui.views.nodes.keys.AbstractKeyNode in project core by jcryptool.

the class AbstractKeyNodeContentProvider method getKey.

/**
 * Tries to retrieve the key from keystore using the default password. If the operation succeeds, the default
 * password will be updated, if it fails, the user have to enter a password into a prompt window.
 */
protected Key getKey(Object inputElement) {
    AbstractKeyNode abstractKeyNode = (AbstractKeyNode) inputElement;
    IKeyStoreAlias alias = abstractKeyNode.getAlias();
    try {
        return KeyStoreManager.getInstance().getKey(alias, KeyStoreManager.KEY_PASSWORD);
    } catch (UnrecoverableEntryException ex) {
        LogUtil.logError(KeyStorePlugin.PLUGIN_ID, "The entered password was not correct.", ex, true);
    } catch (java.security.NoSuchAlgorithmException ex) {
        LogUtil.logError(KeyStorePlugin.PLUGIN_ID, "The requested algorithm is not supported.", ex, true);
    }
    return null;
}
Also used : AbstractKeyNode(org.jcryptool.crypto.keystore.ui.views.nodes.keys.AbstractKeyNode) UnrecoverableEntryException(java.security.UnrecoverableEntryException) IKeyStoreAlias(org.jcryptool.crypto.keystore.keys.IKeyStoreAlias)

Aggregations

AbstractKeyNode (org.jcryptool.crypto.keystore.ui.views.nodes.keys.AbstractKeyNode)7 IKeyStoreListener (org.jcryptool.crypto.keystore.ui.views.interfaces.IKeyStoreListener)4 IKeyStoreAlias (org.jcryptool.crypto.keystore.keys.IKeyStoreAlias)3 CertificateNode (org.jcryptool.crypto.keystore.ui.views.nodes.keys.CertificateNode)3 SecretKeyNode (org.jcryptool.crypto.keystore.ui.views.nodes.keys.SecretKeyNode)2 DSAPrivateKey (de.flexiprovider.core.dsa.DSAPrivateKey)1 DSAPublicKey (de.flexiprovider.core.dsa.DSAPublicKey)1 SSVElGamalPrivateKey (de.flexiprovider.core.elgamal.semanticallysecure.SSVElGamalPrivateKey)1 SSVElGamalPublicKey (de.flexiprovider.core.elgamal.semanticallysecure.SSVElGamalPublicKey)1 MpRSAPrivateKey (de.flexiprovider.core.mprsa.MpRSAPrivateKey)1 ECPrivateKey (de.flexiprovider.ec.keys.ECPrivateKey)1 ECSecretKey (de.flexiprovider.ec.keys.ECSecretKey)1 IQDSAPrivateKey (de.flexiprovider.nf.iq.iqdsa.IQDSAPrivateKey)1 IQDSAPublicKey (de.flexiprovider.nf.iq.iqdsa.IQDSAPublicKey)1 IQGQPublicKey (de.flexiprovider.nf.iq.iqgq.IQGQPublicKey)1 IQRDSAPrivateKey (de.flexiprovider.nf.iq.iqrdsa.IQRDSAPrivateKey)1 IQRDSAPublicKey (de.flexiprovider.nf.iq.iqrdsa.IQRDSAPublicKey)1 McElieceCCA2PrivateKey (de.flexiprovider.pqc.ecc.mceliece.McElieceCCA2PrivateKey)1 McEliecePublicKey (de.flexiprovider.pqc.ecc.mceliece.McEliecePublicKey)1 NiederreiterPrivateKey (de.flexiprovider.pqc.ecc.niederreiter.NiederreiterPrivateKey)1