Search in sources :

Example 1 with CMSSPrivateKeySpec

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

the class CMSSPrivateKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        CMSSKeyFactory keyFactory = new CMSSKeyFactory();
        CMSSPrivateKeySpec keySpec = (CMSSPrivateKeySpec) keyFactory.getKeySpec(key, CMSSPrivateKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_activesubtree, "" + keySpec.getActiveSubtree()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_heightoftrees, "" + keySpec.getHeightOfTrees()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_indexmain, "" + keySpec.getIndexMain()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_indexsub, "" + keySpec.getIndexSub()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_oidstring, "" + keySpec.getOIDString()));
        paramElements.add(new TableEntry(Messages.ContentProvider_maintreeotskey, // $NON-NLS-2$
        "" + Arrays.toString(keySpec.getMaintreeOTSVerificationKey())));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_masks, "" + keySpec.getMasks()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_seeds, "" + keySpec.getSeeds()));
        paramElements.add(new TableEntry(Messages.ContentProvider_subtreerootsig, // $NON-NLS-2$
        "" + Arrays.toString(keySpec.getSubtreeRootSig())));
        paramElements.add(new TableEntry(Messages.ContentProvider_authpaths, // $NON-NLS-2$
        "" + Arrays.toString(keySpec.getAuthPaths())));
    } 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) CMSSKeyFactory(de.flexiprovider.pqc.hbc.cmss.CMSSKeyFactory) CMSSPrivateKeySpec(de.flexiprovider.pqc.hbc.cmss.CMSSPrivateKeySpec)

Aggregations

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