Search in sources :

Example 1 with InvalidKeySpecException

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

the class DSAPrivateKeyContentProvider method getKeySpecElements.

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

Example 2 with InvalidKeySpecException

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

the class IQDSAPrivateKeyContentProvider method getKeySpecElements.

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

Example 3 with InvalidKeySpecException

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

the class IQDSAPublicKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        IQDSAKeyFactory keyFactory = new IQDSAKeyFactory();
        IQDSAPublicKeySpec keySpec = (IQDSAPublicKeySpec) keyFactory.getKeySpec(key, IQDSAPublicKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_alpha, "" + keySpec.getAlpha()));
        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) IQDSAKeyFactory(de.flexiprovider.nf.iq.iqdsa.IQDSAKeyFactory) IQDSAPublicKeySpec(de.flexiprovider.nf.iq.iqdsa.IQDSAPublicKeySpec)

Example 4 with InvalidKeySpecException

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

the class IQGQPrivateKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        IQGQKeyFactory keyFactory = new IQGQKeyFactory();
        IQGQPrivateKeySpec keySpec = (IQGQPrivateKeySpec) keyFactory.getKeySpec(key, IQGQPrivateKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_exponent, "" + keySpec.getExponent()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_theta, "" + keySpec.getTheta()));
        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) IQGQKeyFactory(de.flexiprovider.nf.iq.iqgq.IQGQKeyFactory) ArrayList(java.util.ArrayList) IQGQPrivateKeySpec(de.flexiprovider.nf.iq.iqgq.IQGQPrivateKeySpec) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException)

Example 5 with InvalidKeySpecException

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

the class IQGQPublicKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        IQGQKeyFactory keyFactory = new IQGQKeyFactory();
        IQGQPublicKeySpec keySpec = (IQGQPublicKeySpec) keyFactory.getKeySpec(key, IQGQPublicKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_exponent, "" + keySpec.getExponent()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_alpha, "" + keySpec.getAlpha()));
        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) IQGQPublicKeySpec(de.flexiprovider.nf.iq.iqgq.IQGQPublicKeySpec) IQGQKeyFactory(de.flexiprovider.nf.iq.iqgq.IQGQKeyFactory) ArrayList(java.util.ArrayList) 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