Search in sources :

Example 11 with InvalidKeySpecException

use of de.flexiprovider.api.exceptions.InvalidKeySpecException in project core by jcryptool.

the class AbstractKeyNodeContentProvider method getKeySpec.

protected KeySpec getKeySpec(Key key) {
    try {
        KeyFactory keyFactory = Registry.getKeyFactory(key.getAlgorithm());
        KeySpec keySpec = keyFactory.getKeySpec(key, AlgorithmParameterSpec.class);
        return keySpec;
    } catch (NoSuchAlgorithmException e) {
        return null;
    } catch (InvalidKeySpecException e) {
        return null;
    }
}
Also used : KeySpec(de.flexiprovider.api.keys.KeySpec) NoSuchAlgorithmException(de.flexiprovider.api.exceptions.NoSuchAlgorithmException) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException) KeyFactory(de.flexiprovider.api.keys.KeyFactory)

Example 12 with InvalidKeySpecException

use of de.flexiprovider.api.exceptions.InvalidKeySpecException 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 13 with InvalidKeySpecException

use of de.flexiprovider.api.exceptions.InvalidKeySpecException 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)

Example 14 with InvalidKeySpecException

use of de.flexiprovider.api.exceptions.InvalidKeySpecException in project core by jcryptool.

the class IQRDSAPrivateKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        IQRDSAKeyFactory keyFactory = new IQRDSAKeyFactory();
        IQRDSAPrivateKeySpec keySpec = (IQRDSAPrivateKeySpec) keyFactory.getKeySpec(key, IQRDSAPrivateKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_a, "" + keySpec.getA()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_alpha, "" + keySpec.getAlpha()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_gamma, "" + keySpec.getGamma()));
        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) ArrayList(java.util.ArrayList) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException) IQRDSAPrivateKeySpec(de.flexiprovider.nf.iq.iqrdsa.IQRDSAPrivateKeySpec) IQRDSAKeyFactory(de.flexiprovider.nf.iq.iqrdsa.IQRDSAKeyFactory)

Example 15 with InvalidKeySpecException

use of de.flexiprovider.api.exceptions.InvalidKeySpecException in project core by jcryptool.

the class IQRDSAPublicKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        IQRDSAKeyFactory keyFactory = new IQRDSAKeyFactory();
        IQRDSAPublicKeySpec keySpec = (IQRDSAPublicKeySpec) keyFactory.getKeySpec(key, IQRDSAPublicKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_alpha, "" + keySpec.getAlpha()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_gamma, "" + keySpec.getGamma()));
        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) IQRDSAPublicKeySpec(de.flexiprovider.nf.iq.iqrdsa.IQRDSAPublicKeySpec) ArrayList(java.util.ArrayList) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException) IQRDSAKeyFactory(de.flexiprovider.nf.iq.iqrdsa.IQRDSAKeyFactory)

Aggregations

InvalidKeySpecException (de.flexiprovider.api.exceptions.InvalidKeySpecException)27 ArrayList (java.util.ArrayList)26 TableEntry (org.jcryptool.crypto.keystore.ui.dialogs.TableEntry)26 SSVElGamalKeyFactory (de.flexiprovider.core.elgamal.semanticallysecure.SSVElGamalKeyFactory)2 IQDSAKeyFactory (de.flexiprovider.nf.iq.iqdsa.IQDSAKeyFactory)2 IQGQKeyFactory (de.flexiprovider.nf.iq.iqgq.IQGQKeyFactory)2 IQRDSAKeyFactory (de.flexiprovider.nf.iq.iqrdsa.IQRDSAKeyFactory)2 McElieceCCA2KeyFactory (de.flexiprovider.pqc.ecc.mceliece.McElieceCCA2KeyFactory)2 McElieceKeyFactory (de.flexiprovider.pqc.ecc.mceliece.McElieceKeyFactory)2 NiederreiterKeyFactory (de.flexiprovider.pqc.ecc.niederreiter.NiederreiterKeyFactory)2 CMSSKeyFactory (de.flexiprovider.pqc.hbc.cmss.CMSSKeyFactory)2 GMSSKeyFactory (de.flexiprovider.pqc.hbc.gmss.GMSSKeyFactory)2 MerkleOTSKeyFactory (de.flexiprovider.pqc.ots.merkle.MerkleOTSKeyFactory)2 PFlashKeyFactory (de.flexiprovider.pqc.pflash.PFlashKeyFactory)2 RainbowKeyFactory (de.flexiprovider.pqc.rainbow.RainbowKeyFactory)2 NoSuchAlgorithmException (de.flexiprovider.api.exceptions.NoSuchAlgorithmException)1 KeyFactory (de.flexiprovider.api.keys.KeyFactory)1 KeySpec (de.flexiprovider.api.keys.KeySpec)1 SecretKey (de.flexiprovider.api.keys.SecretKey)1 DSAKeyFactory (de.flexiprovider.core.dsa.DSAKeyFactory)1