use of org.jpos.util.SimpleMsg in project jPOS by jpos.
the class BaseSMAdapter method decryptData.
@Override
public byte[] decryptData(SecureKey privKey, byte[] data, AlgorithmParameterSpec algspec, byte[] iv) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<>();
cmdParameters.add(new SimpleMsg("parameter", "Decription Key", privKey));
cmdParameters.add(new SimpleMsg("parameter", "Encrypted Data", ISOUtil.hexString(data)));
if (algspec != null)
cmdParameters.add(new SimpleMsg("parameter", "Algorithm Spec", algspec));
if (iv != null)
cmdParameters.add(new SimpleMsg("parameter", "Initialization Vector", ISOUtil.hexString(iv)));
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Decrypt Data", cmdParameters));
byte[] result = null;
try {
result = decryptDataImpl(privKey, data, algspec, iv);
List<Loggeable> r = new ArrayList<>();
r.add(new SimpleMsg("result", "Decrypted Data", result));
if (iv != null)
r.add(new SimpleMsg("result", "Initialization Vector", iv));
evt.addMessage(new SimpleMsg("results", r));
} catch (SMException ex) {
evt.addMessage(ex);
throw ex;
} catch (RuntimeException ex) {
evt.addMessage(ex);
throw new SMException(ex);
} finally {
Logger.log(evt);
}
return result;
}
Aggregations