Search in sources :

Example 26 with InvalidKeySpecException

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

the class MerkleOTSPublicKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        MerkleOTSKeyFactory keyFactory = new MerkleOTSKeyFactory();
        MerkleOTSPublicKeySpec keySpec = (MerkleOTSPublicKeySpec) keyFactory.getKeySpec(key, MerkleOTSPublicKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_oidstring, "" + keySpec.getOIDString()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_keybytes, "" + keySpec.getKeyBytes()));
    } 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) MerkleOTSKeyFactory(de.flexiprovider.pqc.ots.merkle.MerkleOTSKeyFactory) MerkleOTSPublicKeySpec(de.flexiprovider.pqc.ots.merkle.MerkleOTSPublicKeySpec)

Example 27 with InvalidKeySpecException

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

the class NiederreiterPublicKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        NiederreiterKeyFactory keyFactory = new NiederreiterKeyFactory();
        NiederreiterPublicKeySpec keySpec = (NiederreiterPublicKeySpec) keyFactory.getKeySpec(key, NiederreiterPublicKeySpec.class);
        if (keySpec == null)
            return null;
    } catch (ClassCastException e) {
        return null;
    } catch (InvalidKeySpecException e) {
        return null;
    }
    return paramElements;
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) NiederreiterPublicKeySpec(de.flexiprovider.pqc.ecc.niederreiter.NiederreiterPublicKeySpec) ArrayList(java.util.ArrayList) NiederreiterKeyFactory(de.flexiprovider.pqc.ecc.niederreiter.NiederreiterKeyFactory) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException)

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