Search in sources :

Example 1 with IQGQKeyFactory

use of de.flexiprovider.nf.iq.iqgq.IQGQKeyFactory in project core by jcryptool.

the class IQGQPrivateKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        IQGQKeyFactory keyFactory = new IQGQKeyFactory();
        IQGQPrivateKeySpec keySpec = (IQGQPrivateKeySpec) keyFactory.getKeySpec(key, IQGQPrivateKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_exponent, "" + keySpec.getExponent()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_theta, "" + keySpec.getTheta()));
        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) IQGQKeyFactory(de.flexiprovider.nf.iq.iqgq.IQGQKeyFactory) ArrayList(java.util.ArrayList) IQGQPrivateKeySpec(de.flexiprovider.nf.iq.iqgq.IQGQPrivateKeySpec) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException)

Example 2 with IQGQKeyFactory

use of de.flexiprovider.nf.iq.iqgq.IQGQKeyFactory in project core by jcryptool.

the class IQGQPublicKeyContentProvider method getKeySpecElements.

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

Aggregations

InvalidKeySpecException (de.flexiprovider.api.exceptions.InvalidKeySpecException)2 IQGQKeyFactory (de.flexiprovider.nf.iq.iqgq.IQGQKeyFactory)2 ArrayList (java.util.ArrayList)2 TableEntry (org.jcryptool.crypto.keystore.ui.dialogs.TableEntry)2 IQGQPrivateKeySpec (de.flexiprovider.nf.iq.iqgq.IQGQPrivateKeySpec)1 IQGQPublicKeySpec (de.flexiprovider.nf.iq.iqgq.IQGQPublicKeySpec)1