use of org.jpos.util.Loggeable in project jPOS by jpos.
the class BaseSMAdapter method calculateCAVV.
@Override
public String calculateCAVV(String accountNo, T cvk, String upn, String authrc, String sfarc) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<>();
cmdParameters.add(new SimpleMsg("parameter", "account number", accountNo));
cmdParameters.add(new SimpleMsg("parameter", "cvk", cvk == null ? "" : cvk));
cmdParameters.add(new SimpleMsg("parameter", "unpredictable number", upn));
cmdParameters.add(new SimpleMsg("parameter", "auth rc", authrc));
cmdParameters.add(new SimpleMsg("parameter", "second factor auth rc", sfarc));
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Calculate CAVV/AAV", cmdParameters));
String result = null;
try {
result = calculateCAVVImpl(accountNo, cvk, upn, authrc, sfarc);
evt.addMessage(new SimpleMsg("result", "Calculated CAVV/AAV", result));
} catch (Exception e) {
evt.addMessage(e);
throw e instanceof SMException ? (SMException) e : new SMException(e);
} finally {
Logger.log(evt);
}
return result;
}
use of org.jpos.util.Loggeable in project jPOS by jpos.
the class BaseSMAdapter method calculatePVV.
@Override
public String calculatePVV(EncryptedPIN pinUnderLMK, T pvkA, T pvkB, int pvkIdx, List<String> excludes) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<>();
cmdParameters.add(new SimpleMsg("parameter", "account number", pinUnderLMK.getAccountNumber()));
cmdParameters.add(new SimpleMsg("parameter", "PIN under LMK", pinUnderLMK));
cmdParameters.add(new SimpleMsg("parameter", "PVK-A", pvkA == null ? "" : pvkA));
cmdParameters.add(new SimpleMsg("parameter", "PVK-B", pvkB == null ? "" : pvkB));
cmdParameters.add(new SimpleMsg("parameter", "PVK index", pvkIdx));
if (excludes != null && !excludes.isEmpty())
cmdParameters.add(new SimpleMsg("parameter", "Excluded PINs list", excludes));
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Calculate PVV", cmdParameters));
String result = null;
try {
result = calculatePVVImpl(pinUnderLMK, pvkA, pvkB, pvkIdx, excludes);
evt.addMessage(new SimpleMsg("result", "Calculated PVV", result));
} catch (Exception e) {
evt.addMessage(e);
throw e instanceof SMException ? (SMException) e : new SMException(e);
} finally {
Logger.log(evt);
}
return result;
}
use of org.jpos.util.Loggeable in project jPOS by jpos.
the class BaseSMAdapter method encryptData.
@Override
public byte[] encryptData(SecureKey encKey, byte[] data, AlgorithmParameterSpec algspec, byte[] iv) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<>();
cmdParameters.add(new SimpleMsg("parameter", "Encription Key", encKey));
cmdParameters.add(new SimpleMsg("parameter", "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", "Encrypt Data", cmdParameters));
byte[] result = null;
try {
result = encryptDataImpl(encKey, data, algspec, iv);
List<Loggeable> r = new ArrayList<>();
r.add(new SimpleMsg("result", "Encrypted 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;
}
use of org.jpos.util.Loggeable in project jPOS by jpos.
the class BaseSMAdapter method translateKeyFromOldLMK.
@Override
public SecureKey translateKeyFromOldLMK(SecureKey key, SecureKeySpec keySpec) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<>();
cmdParameters.add(new SimpleMsg("parameter", "Key under old LMK", key));
cmdParameters.add(new SimpleMsg("parameter", "Key Specification", keySpec));
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Translate Key from old to new LMK", cmdParameters));
SecureKey result = null;
try {
result = translateKeyFromOldLMKImpl(key, keySpec);
evt.addMessage(new SimpleMsg("result", "Translated Key under new LMK", result));
} catch (Exception e) {
evt.addMessage(e);
throw e instanceof SMException ? (SMException) e : new SMException(e);
} finally {
Logger.log(evt);
}
return result;
}
use of org.jpos.util.Loggeable in project jPOS by jpos.
the class BaseSMAdapter method generateKey.
@Override
public SecureKey generateKey(SecureKeySpec keySpec) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<>();
cmdParameters.add(new SimpleMsg("parameter", "Key Specification", keySpec));
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Generate Key", cmdParameters));
SecureKey result = null;
try {
result = generateKeyImpl(keySpec);
evt.addMessage(new SimpleMsg("result", "Generated Key", result));
} catch (Exception e) {
evt.addMessage(e);
throw e instanceof SMException ? (SMException) e : new SMException(e);
} finally {
Logger.log(evt);
}
return result;
}
Aggregations