Search in sources :

Example 21 with InvalidKeySpecException

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

the class SSVElGamalPublicKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        SSVElGamalKeyFactory keyFactory = new SSVElGamalKeyFactory();
        SSVElGamalPublicKeySpec keySpec = (SSVElGamalPublicKeySpec) keyFactory.getKeySpec(key, SSVElGamalPublicKeySpec.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) SSVElGamalPublicKeySpec(de.flexiprovider.core.elgamal.semanticallysecure.SSVElGamalPublicKeySpec) SSVElGamalKeyFactory(de.flexiprovider.core.elgamal.semanticallysecure.SSVElGamalKeyFactory) ArrayList(java.util.ArrayList) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException)

Example 22 with InvalidKeySpecException

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

the class PBESecretKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        PBEKeyFactory keyFactory = new PBEKeyFactory();
        PBEKeySpec keySpec = (PBEKeySpec) keyFactory.getKeySpec((SecretKey) key, PBEKeySpec.class);
        if (keySpec == null)
            return null;
        paramElements.add(// $NON-NLS-2$
        new TableEntry(Messages.ContentProvider_iterationcount, "" + keySpec.getIterationCount()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_keylength, "" + keySpec.getKeyLength()));
        paramElements.add(new TableEntry(Messages.ContentProvider_password, // $NON-NLS-2$
        "" + Arrays.toString(keySpec.getPassword())));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_salt, "" + Arrays.toString(keySpec.getSalt())));
    } catch (ClassCastException e) {
        return null;
    } catch (InvalidKeySpecException e) {
        return null;
    }
    return paramElements;
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) PBEKeySpec(de.flexiprovider.core.pbe.PBEKeySpec) SecretKey(de.flexiprovider.api.keys.SecretKey) ECSecretKey(de.flexiprovider.ec.keys.ECSecretKey) PBEKeyFactory(de.flexiprovider.core.pbe.PBEKeyFactory) ArrayList(java.util.ArrayList) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException)

Example 23 with InvalidKeySpecException

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

the class McElieceCCA2PublicKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        McElieceCCA2KeyFactory keyFactory = new McElieceCCA2KeyFactory();
        McElieceCCA2PublicKeySpec keySpec = (McElieceCCA2PublicKeySpec) keyFactory.getKeySpec(key, McElieceCCA2PublicKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_n, "" + keySpec.getN()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_t, "" + keySpec.getT()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_matrixg, "" + keySpec.getMatrixG()));
    } catch (ClassCastException e) {
        return null;
    } catch (InvalidKeySpecException e) {
        return null;
    }
    return paramElements;
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) McElieceCCA2KeyFactory(de.flexiprovider.pqc.ecc.mceliece.McElieceCCA2KeyFactory) ArrayList(java.util.ArrayList) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException) McElieceCCA2PublicKeySpec(de.flexiprovider.pqc.ecc.mceliece.McElieceCCA2PublicKeySpec)

Example 24 with InvalidKeySpecException

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

the class McEliecePublicKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        McElieceKeyFactory keyFactory = new McElieceKeyFactory();
        McEliecePublicKeySpec keySpec = (McEliecePublicKeySpec) keyFactory.getKeySpec(key, McEliecePublicKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_n, "" + keySpec.getN()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_t, "" + keySpec.getT()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_g, "" + keySpec.getG()));
    } catch (ClassCastException e) {
        return null;
    } catch (InvalidKeySpecException e) {
        return null;
    }
    return paramElements;
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) McElieceKeyFactory(de.flexiprovider.pqc.ecc.mceliece.McElieceKeyFactory) McEliecePublicKeySpec(de.flexiprovider.pqc.ecc.mceliece.McEliecePublicKeySpec) ArrayList(java.util.ArrayList) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException)

Example 25 with InvalidKeySpecException

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

the class MerkleOTSPrivateKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        MerkleOTSKeyFactory keyFactory = new MerkleOTSKeyFactory();
        MerkleOTSPrivateKeySpec keySpec = (MerkleOTSPrivateKeySpec) keyFactory.getKeySpec(key, MerkleOTSPrivateKeySpec.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) MerkleOTSPrivateKeySpec(de.flexiprovider.pqc.ots.merkle.MerkleOTSPrivateKeySpec)

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