use of de.flexiprovider.core.pbe.PBEKeyFactory in project core by jcryptool.
the class PBESecretKeyContentProvider method getKeySpecElements.
@Override
protected List<TableEntry> getKeySpecElements(Key key) {
List<TableEntry> paramElements = new ArrayList<TableEntry>();
try {
PBEKeyFactory keyFactory = new PBEKeyFactory();
PBEKeySpec keySpec = (PBEKeySpec) keyFactory.getKeySpec((SecretKey) key, PBEKeySpec.class);
if (keySpec == null)
return null;
paramElements.add(// $NON-NLS-2$
new TableEntry(Messages.ContentProvider_iterationcount, "" + keySpec.getIterationCount()));
// $NON-NLS-2$
paramElements.add(new TableEntry(Messages.ContentProvider_keylength, "" + keySpec.getKeyLength()));
paramElements.add(new TableEntry(Messages.ContentProvider_password, // $NON-NLS-2$
"" + Arrays.toString(keySpec.getPassword())));
// $NON-NLS-2$
paramElements.add(new TableEntry(Messages.ContentProvider_salt, "" + Arrays.toString(keySpec.getSalt())));
} catch (ClassCastException e) {
return null;
} catch (InvalidKeySpecException e) {
return null;
}
return paramElements;
}
Aggregations