Search in sources :

Example 1 with PFlashKeyFactory

use of de.flexiprovider.pqc.pflash.PFlashKeyFactory in project core by jcryptool.

the class PFlashPublicKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        PFlashKeyFactory keyFactory = new PFlashKeyFactory();
        PFlashPublicKeySpec keySpec = (PFlashPublicKeySpec) keyFactory.getKeySpec(key, PFlashPublicKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_oidstring, "" + keySpec.getOIDString()));
    } 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) PFlashPublicKeySpec(de.flexiprovider.pqc.pflash.PFlashPublicKeySpec) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException) PFlashKeyFactory(de.flexiprovider.pqc.pflash.PFlashKeyFactory)

Example 2 with PFlashKeyFactory

use of de.flexiprovider.pqc.pflash.PFlashKeyFactory in project core by jcryptool.

the class PFlashPrivateKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        PFlashKeyFactory keyFactory = new PFlashKeyFactory();
        PFlashPrivateKeySpec keySpec = (PFlashPrivateKeySpec) keyFactory.getKeySpec(key, PFlashPrivateKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_oidstring, "" + keySpec.getOIDString()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_c_s, "" + keySpec.getC_S()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_c_t, "" + keySpec.getC_T()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_m_s, "" + keySpec.getM_S()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_m_t, "" + keySpec.getM_T()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_poly_384, "" + keySpec.getPoly_384()));
    } catch (ClassCastException e) {
        return null;
    } catch (InvalidKeySpecException e) {
        return null;
    }
    return paramElements;
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) PFlashPrivateKeySpec(de.flexiprovider.pqc.pflash.PFlashPrivateKeySpec) ArrayList(java.util.ArrayList) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException) PFlashKeyFactory(de.flexiprovider.pqc.pflash.PFlashKeyFactory)

Aggregations

InvalidKeySpecException (de.flexiprovider.api.exceptions.InvalidKeySpecException)2 PFlashKeyFactory (de.flexiprovider.pqc.pflash.PFlashKeyFactory)2 ArrayList (java.util.ArrayList)2 TableEntry (org.jcryptool.crypto.keystore.ui.dialogs.TableEntry)2 PFlashPrivateKeySpec (de.flexiprovider.pqc.pflash.PFlashPrivateKeySpec)1 PFlashPublicKeySpec (de.flexiprovider.pqc.pflash.PFlashPublicKeySpec)1