Search in sources :

Example 1 with Cipher

use of de.flexiprovider.api.Cipher in project core by jcryptool.

the class AbstractKeyNodeContentProvider method getCipherElements.

private List<TableEntry> getCipherElements(Object inputElement) {
    Key key = (Key) inputElement;
    if (key == null)
        return null;
    List<TableEntry> cipherElements = new ArrayList<TableEntry>();
    try {
        Cipher cipher = Registry.getCipher(key.getAlgorithm());
        if (cipher.getIV() != null)
            cipherElements.add(new TableEntry(Messages.AbstractKeyNodeContentProvider_InitVector, cipher.getIV().toString()));
        if (cipher.getBlockSize() != 0)
            cipherElements.add(new TableEntry(Messages.AbstractKeyNodeContentProvider_BlockSize, Integer.toString(cipher.getBlockSize())));
        try {
            cipherElements.add(new TableEntry(Messages.AbstractKeyNodeContentProvider_CipherKeySize, Integer.toString(cipher.getKeySize(key))));
        } catch (InvalidKeyException ex) {
            LogUtil.logError(ex);
        }
    } catch (NoSuchAlgorithmException e) {
        return cipherElements;
    }
    return cipherElements;
}
Also used : TableEntry(org.jcryptool.crypto.keystore.ui.dialogs.TableEntry) ArrayList(java.util.ArrayList) Cipher(de.flexiprovider.api.Cipher) NoSuchAlgorithmException(de.flexiprovider.api.exceptions.NoSuchAlgorithmException) InvalidKeyException(de.flexiprovider.api.exceptions.InvalidKeyException) Key(de.flexiprovider.api.keys.Key)

Aggregations

Cipher (de.flexiprovider.api.Cipher)1 InvalidKeyException (de.flexiprovider.api.exceptions.InvalidKeyException)1 NoSuchAlgorithmException (de.flexiprovider.api.exceptions.NoSuchAlgorithmException)1 Key (de.flexiprovider.api.keys.Key)1 ArrayList (java.util.ArrayList)1 TableEntry (org.jcryptool.crypto.keystore.ui.dialogs.TableEntry)1