Search in sources :

Example 1 with IQRDSAKeyFactory

use of de.flexiprovider.nf.iq.iqrdsa.IQRDSAKeyFactory in project core by jcryptool.

the class IQRDSAPrivateKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        IQRDSAKeyFactory keyFactory = new IQRDSAKeyFactory();
        IQRDSAPrivateKeySpec keySpec = (IQRDSAPrivateKeySpec) keyFactory.getKeySpec(key, IQRDSAPrivateKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_a, "" + keySpec.getA()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_alpha, "" + keySpec.getAlpha()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_gamma, "" + keySpec.getGamma()));
        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) IQRDSAPrivateKeySpec(de.flexiprovider.nf.iq.iqrdsa.IQRDSAPrivateKeySpec) IQRDSAKeyFactory(de.flexiprovider.nf.iq.iqrdsa.IQRDSAKeyFactory)

Example 2 with IQRDSAKeyFactory

use of de.flexiprovider.nf.iq.iqrdsa.IQRDSAKeyFactory in project core by jcryptool.

the class IQRDSAPublicKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        IQRDSAKeyFactory keyFactory = new IQRDSAKeyFactory();
        IQRDSAPublicKeySpec keySpec = (IQRDSAPublicKeySpec) keyFactory.getKeySpec(key, IQRDSAPublicKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_alpha, "" + keySpec.getAlpha()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_gamma, "" + keySpec.getGamma()));
        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) IQRDSAPublicKeySpec(de.flexiprovider.nf.iq.iqrdsa.IQRDSAPublicKeySpec) ArrayList(java.util.ArrayList) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException) IQRDSAKeyFactory(de.flexiprovider.nf.iq.iqrdsa.IQRDSAKeyFactory)

Aggregations

InvalidKeySpecException (de.flexiprovider.api.exceptions.InvalidKeySpecException)2 IQRDSAKeyFactory (de.flexiprovider.nf.iq.iqrdsa.IQRDSAKeyFactory)2 ArrayList (java.util.ArrayList)2 TableEntry (org.jcryptool.crypto.keystore.ui.dialogs.TableEntry)2 IQRDSAPrivateKeySpec (de.flexiprovider.nf.iq.iqrdsa.IQRDSAPrivateKeySpec)1 IQRDSAPublicKeySpec (de.flexiprovider.nf.iq.iqrdsa.IQRDSAPublicKeySpec)1