Search in sources :

Example 1 with IQDSAKeyFactory

use of de.flexiprovider.nf.iq.iqdsa.IQDSAKeyFactory in project core by jcryptool.

the class IQDSAPrivateKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        IQDSAKeyFactory keyFactory = new IQDSAKeyFactory();
        IQDSAPrivateKeySpec keySpec = (IQDSAPrivateKeySpec) keyFactory.getKeySpec(key, IQDSAPrivateKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_a, "" + keySpec.getA()));
        paramElements.addAll(getParameters(keySpec));
    } catch (ClassCastException e) {
        return null;
    } catch (InvalidKeySpecException e) {
        return null;
    }
    return paramElements;
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) IQDSAPrivateKeySpec(de.flexiprovider.nf.iq.iqdsa.IQDSAPrivateKeySpec) ArrayList(java.util.ArrayList) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException) IQDSAKeyFactory(de.flexiprovider.nf.iq.iqdsa.IQDSAKeyFactory)

Example 2 with IQDSAKeyFactory

use of de.flexiprovider.nf.iq.iqdsa.IQDSAKeyFactory in project core by jcryptool.

the class IQDSAPublicKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        IQDSAKeyFactory keyFactory = new IQDSAKeyFactory();
        IQDSAPublicKeySpec keySpec = (IQDSAPublicKeySpec) keyFactory.getKeySpec(key, IQDSAPublicKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_alpha, "" + keySpec.getAlpha()));
        paramElements.addAll(getParameters(keySpec));
    } catch (ClassCastException e) {
        return null;
    } catch (InvalidKeySpecException e) {
        return null;
    }
    return paramElements;
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) ArrayList(java.util.ArrayList) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException) IQDSAKeyFactory(de.flexiprovider.nf.iq.iqdsa.IQDSAKeyFactory) IQDSAPublicKeySpec(de.flexiprovider.nf.iq.iqdsa.IQDSAPublicKeySpec)

Aggregations

InvalidKeySpecException (de.flexiprovider.api.exceptions.InvalidKeySpecException)2 IQDSAKeyFactory (de.flexiprovider.nf.iq.iqdsa.IQDSAKeyFactory)2 ArrayList (java.util.ArrayList)2 TableEntry (org.jcryptool.crypto.keystore.ui.dialogs.TableEntry)2 IQDSAPrivateKeySpec (de.flexiprovider.nf.iq.iqdsa.IQDSAPrivateKeySpec)1 IQDSAPublicKeySpec (de.flexiprovider.nf.iq.iqdsa.IQDSAPublicKeySpec)1