Search in sources :

Example 1 with GMSSKeyFactory

use of de.flexiprovider.pqc.hbc.gmss.GMSSKeyFactory 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)

Example 2 with GMSSKeyFactory

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

the class GMSSPublicKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        GMSSKeyFactory keyFactory = new GMSSKeyFactory();
        GMSSPublicKeySpec keySpec = (GMSSPublicKeySpec) keyFactory.getKeySpec(key, GMSSPublicKeySpec.class);
        if (keySpec == null)
            return null;
        paramElements.add(new TableEntry(Messages.ContentProvider_publickey, // $NON-NLS-2$
        "" + Arrays.toString(keySpec.getPublicKey())));
        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) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException) GMSSPublicKeySpec(de.flexiprovider.pqc.hbc.gmss.GMSSPublicKeySpec)

Aggregations

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