Search in sources :

Example 1 with McElieceCCA2KeyFactory

use of de.flexiprovider.pqc.ecc.mceliece.McElieceCCA2KeyFactory 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 2 with McElieceCCA2KeyFactory

use of de.flexiprovider.pqc.ecc.mceliece.McElieceCCA2KeyFactory 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)

Aggregations

InvalidKeySpecException (de.flexiprovider.api.exceptions.InvalidKeySpecException)2 McElieceCCA2KeyFactory (de.flexiprovider.pqc.ecc.mceliece.McElieceCCA2KeyFactory)2 ArrayList (java.util.ArrayList)2 TableEntry (org.jcryptool.crypto.keystore.ui.dialogs.TableEntry)2 McElieceCCA2PrivateKeySpec (de.flexiprovider.pqc.ecc.mceliece.McElieceCCA2PrivateKeySpec)1 McElieceCCA2PublicKeySpec (de.flexiprovider.pqc.ecc.mceliece.McElieceCCA2PublicKeySpec)1