Search in sources :

Example 1 with CMSSPublicKeySpec

use of de.flexiprovider.pqc.hbc.cmss.CMSSPublicKeySpec in project core by jcryptool.

the class CMSSPublicKeyContentProvider method getKeySpecElements.

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

Aggregations

InvalidKeySpecException (de.flexiprovider.api.exceptions.InvalidKeySpecException)1 CMSSKeyFactory (de.flexiprovider.pqc.hbc.cmss.CMSSKeyFactory)1 CMSSPublicKeySpec (de.flexiprovider.pqc.hbc.cmss.CMSSPublicKeySpec)1 ArrayList (java.util.ArrayList)1 TableEntry (org.jcryptool.crypto.keystore.ui.dialogs.TableEntry)1