Search in sources :

Example 6 with InvalidKeySpecException

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

the class McElieceCCA2PrivateKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        McElieceCCA2KeyFactory keyFactory = new McElieceCCA2KeyFactory();
        McElieceCCA2PrivateKeySpec keySpec = (McElieceCCA2PrivateKeySpec) keyFactory.getKeySpec(key, McElieceCCA2PrivateKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_k, "" + keySpec.getK()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_n, "" + keySpec.getN()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_field, "" + keySpec.getField()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_goppapoly, "" + keySpec.getGoppaPoly()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_h, "" + keySpec.getH()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_p, "" + keySpec.getP()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_qinv, "" + keySpec.getQInv()));
    } 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) McElieceCCA2PrivateKeySpec(de.flexiprovider.pqc.ecc.mceliece.McElieceCCA2PrivateKeySpec) ArrayList(java.util.ArrayList) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException)

Example 7 with InvalidKeySpecException

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

the class McEliecePrivateKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        McElieceKeyFactory keyFactory = new McElieceKeyFactory();
        McEliecePrivateKeySpec keySpec = (McEliecePrivateKeySpec) keyFactory.getKeySpec(key, McEliecePrivateKeySpec.class);
        if (keySpec == null)
            return null;
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_k, "" + keySpec.getK()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_n, "" + keySpec.getN()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_field, "" + keySpec.getField()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_goppapoly, "" + keySpec.getGoppaPoly()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_h, "" + keySpec.getH()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_p1, "" + keySpec.getP1()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_p2, "" + keySpec.getP2()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_qinv, "" + keySpec.getQInv()));
        // $NON-NLS-2$
        paramElements.add(new TableEntry(Messages.ContentProvider_sinv, "" + keySpec.getSInv()));
    } 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) ArrayList(java.util.ArrayList) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException) McEliecePrivateKeySpec(de.flexiprovider.pqc.ecc.mceliece.McEliecePrivateKeySpec)

Example 8 with InvalidKeySpecException

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

the class NiederreiterPrivateKeyContentProvider method getKeySpecElements.

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

Example 9 with InvalidKeySpecException

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

the class PFlashPublicKeyContentProvider method getKeySpecElements.

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

Example 10 with InvalidKeySpecException

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

the class RainbowPublicKeyContentProvider method getKeySpecElements.

@Override
protected List<TableEntry> getKeySpecElements(Key key) {
    List<TableEntry> paramElements = new ArrayList<TableEntry>();
    try {
        RainbowKeyFactory keyFactory = new RainbowKeyFactory();
        RainbowPublicKeySpec keySpec = (RainbowPublicKeySpec) keyFactory.getKeySpec(key, RainbowPublicKeySpec.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_doclength, "" + keySpec.getDocLength()));
    } catch (ClassCastException e) {
        return null;
    } catch (InvalidKeySpecException e) {
        return null;
    }
    return paramElements;
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) RainbowPublicKeySpec(de.flexiprovider.pqc.rainbow.RainbowPublicKeySpec) ArrayList(java.util.ArrayList) InvalidKeySpecException(de.flexiprovider.api.exceptions.InvalidKeySpecException) RainbowKeyFactory(de.flexiprovider.pqc.rainbow.RainbowKeyFactory)

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