Search in sources :

Example 1 with GMSSPrivateKeySpec

use of de.flexiprovider.pqc.hbc.gmss.GMSSPrivateKeySpec in project core by jcryptool.

the class GMSSPrivateKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        GMSSKeyFactory keyFactory = new GMSSKeyFactory();
        GMSSPrivateKeySpec keySpec = (GMSSPrivateKeySpec) keyFactory.getKeySpec(key, GMSSPrivateKeySpec.class);
        if (keySpec == null)
            return null;
        paramElements.add(new TableEntry(Messages.ContentProvider_algnames, // $NON-NLS-2$
        "" + Arrays.toString(keySpec.getAlgNames())));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_curauthpath, "" + keySpec.getCurrentAuthPath()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_curretain, "" + keySpec.getCurrentRetain()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_currootsig, "" + keySpec.getCurrentRootSig()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_curseed, "" + keySpec.getCurrentSeed()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_curstack, "" + keySpec.getCurrentStack()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_curtreehash, "" + keySpec.getCurrentTreehash()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_index, "" + Arrays.toString(keySpec.getIndex())));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_keep, "" + keySpec.getKeep()));
        paramElements.add(new TableEntry(Messages.ContentProvider_mintreehash, // $NON-NLS-2$
        "" + Arrays.toString(keySpec.getMinTreehash())));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_nextauthpath, "" + keySpec.getNextAuthPath()));
        paramElements.add(new TableEntry(Messages.ContentProvider_nextnextleaf, // $NON-NLS-2$
        "" + Arrays.toString(keySpec.getNextNextLeaf())));
        paramElements.add(new TableEntry(Messages.ContentProvider_nextnextroot, // $NON-NLS-2$
        "" + Arrays.toString(keySpec.getNextNextRoot())));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_nextnextseed, "" + keySpec.getNextNextSeed()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_nextretain, "" + keySpec.getNextRetain()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_nextroot, "" + keySpec.getNextRoot()));
        paramElements.add(new TableEntry(Messages.ContentProvider_nextrootsig, // $NON-NLS-2$
        "" + Arrays.toString(keySpec.getNextRootSig())));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_nextstack, "" + keySpec.getNextStack()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_nexttreehash, "" + keySpec.getNextTreehash()));
        paramElements.add(new TableEntry(Messages.ContentProvider_upperleaf, // $NON-NLS-2$
        "" + Arrays.toString(keySpec.getUpperLeaf())));
        paramElements.add(new TableEntry(Messages.ContentProvider_uppertreehashleaf, // $NON-NLS-2$
        "" + Arrays.toString(keySpec.getUpperTreehashLeaf())));
        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) GMSSKeyFactory(de.flexiprovider.pqc.hbc.gmss.GMSSKeyFactory) ArrayList(java.util.ArrayList) GMSSPrivateKeySpec(de.flexiprovider.pqc.hbc.gmss.GMSSPrivateKeySpec) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException)

Aggregations

InvalidKeySpecException (de.flexiprovider.api.exceptions.InvalidKeySpecException)1 GMSSKeyFactory (de.flexiprovider.pqc.hbc.gmss.GMSSKeyFactory)1 GMSSPrivateKeySpec (de.flexiprovider.pqc.hbc.gmss.GMSSPrivateKeySpec)1 ArrayList (java.util.ArrayList)1 TableEntry (org.jcryptool.crypto.keystore.ui.dialogs.TableEntry)1