use of org.jpos.util.Loggeable in project jPOS by jpos.
the class BaseSMAdapter method generatePIN.
@Override
public EncryptedPIN generatePIN(String accountNumber, int pinLen, List<String> excludes) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<>();
cmdParameters.add(new SimpleMsg("parameter", "account number", accountNumber));
cmdParameters.add(new SimpleMsg("parameter", "PIN length", pinLen));
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", "Generate PIN", cmdParameters));
EncryptedPIN result = null;
try {
result = generatePINImpl(accountNumber, pinLen, excludes);
evt.addMessage(new SimpleMsg("result", "Generated PIN", 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 calculateIBMPINOffset.
@Override
public String calculateIBMPINOffset(EncryptedPIN pinUnderKd1, SecureDESKey kd1, SecureDESKey pvk, String decTab, String pinValData, int minPinLen, List<String> excludes) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<Loggeable>();
cmdParameters.add(new SimpleMsg("parameter", "account number", pinUnderKd1.getAccountNumber()));
cmdParameters.add(new SimpleMsg("parameter", "PIN under Data Key 1", pinUnderKd1));
cmdParameters.add(new SimpleMsg("parameter", "Data Key 1", kd1));
cmdParameters.add(new SimpleMsg("parameter", "PVK", pvk));
cmdParameters.add(new SimpleMsg("parameter", "decimalisation table", decTab));
cmdParameters.add(new SimpleMsg("parameter", "PIN validation data", pinValData));
cmdParameters.add(new SimpleMsg("parameter", "minimum PIN length", minPinLen));
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 PIN offset", cmdParameters.toArray(new Loggeable[cmdParameters.size()])));
String result = null;
try {
result = calculateIBMPINOffsetImpl(pinUnderKd1, kd1, pvk, decTab, pinValData, minPinLen, excludes);
evt.addMessage(new SimpleMsg("result", "Calculated PIN offset", 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 calculateSignature.
@Override
public byte[] calculateSignature(MessageDigest hash, SecurePrivateKey privateKey, byte[] data) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<Loggeable>();
cmdParameters.add(new SimpleMsg("parameter", "Hash Identifier", hash));
cmdParameters.add(new SimpleMsg("parameter", "Private Key", privateKey));
cmdParameters.add(new SimpleMsg("parameter", "data", data));
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Generate data signature", cmdParameters));
byte[] result = null;
try {
result = calculateSignatureImpl(hash, privateKey, data);
evt.addMessage(new SimpleMsg("result", "Data Signature", 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 printPIN.
@Override
public void printPIN(String accountNo, EncryptedPIN pinUnderKd1, SecureDESKey kd1, String template, Map<String, String> fields) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<Loggeable>();
cmdParameters.add(new SimpleMsg("parameter", "account number", accountNo == null ? "" : accountNo));
cmdParameters.add(new SimpleMsg("parameter", "PIN under Key data 1", pinUnderKd1 == null ? "" : pinUnderKd1));
if (kd1 != null)
cmdParameters.add(new SimpleMsg("parameter", "Key data 1", kd1));
cmdParameters.add(new SimpleMsg("parameter", "Template", template == null ? "" : template));
if (fields != null)
cmdParameters.add(new SimpleMsg("parameter", "Fields", fields));
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Print PIN", cmdParameters.toArray(new Loggeable[0])));
try {
printPINImpl(accountNo, pinUnderKd1, kd1, template, fields);
} catch (Exception e) {
evt.addMessage(e);
throw e instanceof SMException ? (SMException) e : new SMException(e);
} finally {
Logger.log(evt);
}
}
use of org.jpos.util.Loggeable in project jPOS by jpos.
the class BaseSMAdapter method generateCBC_MAC.
@Override
public byte[] generateCBC_MAC(byte[] data, T kd) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<>();
cmdParameters.add(new SimpleMsg("parameter", "data", data));
cmdParameters.add(new SimpleMsg("parameter", "data key", kd));
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Generate CBC-MAC", cmdParameters));
byte[] result = null;
try {
result = generateCBC_MACImpl(data, kd);
evt.addMessage(new SimpleMsg("result", "CBC-MAC", result));
} catch (Exception e) {
evt.addMessage(e);
throw e instanceof SMException ? (SMException) e : new SMException(e);
} finally {
Logger.log(evt);
}
return result;
}
Aggregations