Search in sources :

Example 1 with McEliecePublicKeySpec

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

Aggregations

InvalidKeySpecException (de.flexiprovider.api.exceptions.InvalidKeySpecException)1 McElieceKeyFactory (de.flexiprovider.pqc.ecc.mceliece.McElieceKeyFactory)1 McEliecePublicKeySpec (de.flexiprovider.pqc.ecc.mceliece.McEliecePublicKeySpec)1 ArrayList (java.util.ArrayList)1 TableEntry (org.jcryptool.crypto.keystore.ui.dialogs.TableEntry)1