Search in sources :

Example 1 with RainbowKeyFactory

use of de.flexiprovider.pqc.rainbow.RainbowKeyFactory in project core by jcryptool.

the class RainbowPublicKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        RainbowKeyFactory keyFactory = new RainbowKeyFactory();
        RainbowPublicKeySpec keySpec = (RainbowPublicKeySpec) keyFactory.getKeySpec(key, RainbowPublicKeySpec.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_doclength, "" + keySpec.getDocLength()));
    } catch (ClassCastException e) {
        return null;
    } catch (InvalidKeySpecException e) {
        return null;
    }
    return paramElements;
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) RainbowPublicKeySpec(de.flexiprovider.pqc.rainbow.RainbowPublicKeySpec) ArrayList(java.util.ArrayList) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException) RainbowKeyFactory(de.flexiprovider.pqc.rainbow.RainbowKeyFactory)

Example 2 with RainbowKeyFactory

use of de.flexiprovider.pqc.rainbow.RainbowKeyFactory in project core by jcryptool.

the class RainbowPrivateKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        RainbowKeyFactory keyFactory = new RainbowKeyFactory();
        RainbowPrivateKeySpec keySpec = (RainbowPrivateKeySpec) keyFactory.getKeySpec(key, RainbowPrivateKeySpec.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) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException) RainbowKeyFactory(de.flexiprovider.pqc.rainbow.RainbowKeyFactory) RainbowPrivateKeySpec(de.flexiprovider.pqc.rainbow.RainbowPrivateKeySpec)

Aggregations

InvalidKeySpecException (de.flexiprovider.api.exceptions.InvalidKeySpecException)2 RainbowKeyFactory (de.flexiprovider.pqc.rainbow.RainbowKeyFactory)2 ArrayList (java.util.ArrayList)2 TableEntry (org.jcryptool.crypto.keystore.ui.dialogs.TableEntry)2 RainbowPrivateKeySpec (de.flexiprovider.pqc.rainbow.RainbowPrivateKeySpec)1 RainbowPublicKeySpec (de.flexiprovider.pqc.rainbow.RainbowPublicKeySpec)1