use of org.jpos.util.Loggeable in project jPOS by jpos.
the class BaseSMAdapter method printPIN.
@Override
public void printPIN(String accountNo, EncryptedPIN pinUnderKd1, T kd1, String template, Map<String, String> fields) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<>();
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));
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 exportKey.
@Override
public byte[] exportKey(SecureDESKey key, SecureDESKey kek) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<>();
cmdParameters.add(new SimpleMsg("parameter", "Key", key));
cmdParameters.add(new SimpleMsg("parameter", "Key-Encrypting Key", kek));
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Export Key", cmdParameters));
byte[] result = null;
try {
result = exportKeyImpl(key, kek);
evt.addMessage(new SimpleMsg("result", "Exported Key", 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 verifyARQC.
@Override
public boolean verifyARQC(MKDMethod mkdm, SKDMethod skdm, T imkac, String accoutNo, String acctSeqNo, byte[] arqc, byte[] atc, byte[] upn, byte[] txnData) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<>();
cmdParameters.add(new SimpleMsg("parameter", "mkd method", mkdm));
cmdParameters.add(new SimpleMsg("parameter", "skd method", skdm));
cmdParameters.add(new SimpleMsg("parameter", "imk-ac", imkac));
cmdParameters.add(new SimpleMsg("parameter", "account number", accoutNo));
cmdParameters.add(new SimpleMsg("parameter", "accnt seq no", acctSeqNo));
cmdParameters.add(new SimpleMsg("parameter", "arqc", arqc == null ? "" : ISOUtil.hexString(arqc)));
cmdParameters.add(new SimpleMsg("parameter", "atc", atc == null ? "" : ISOUtil.hexString(atc)));
cmdParameters.add(new SimpleMsg("parameter", "upn", upn == null ? "" : ISOUtil.hexString(upn)));
cmdParameters.add(new SimpleMsg("parameter", "txn data", txnData == null ? "" : ISOUtil.hexString(txnData)));
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Verify ARQC/TC/AAC", cmdParameters));
try {
boolean r = verifyARQCImpl(mkdm, skdm, imkac, accoutNo, acctSeqNo, arqc, atc, upn, txnData);
evt.addMessage(new SimpleMsg("result", "Verification status", r ? "valid" : "invalid"));
return r;
} 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 exportKey.
@Override
public SecureKey exportKey(SecureKey kek, SecureKey key, SecureKeySpec keySpec) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<>();
cmdParameters.add(new SimpleMsg("parameter", "Key-Encrypting Key", kek));
cmdParameters.add(new SimpleMsg("parameter", "Key", key));
cmdParameters.add(new SimpleMsg("parameter", "Key Specification", keySpec));
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Export Key", cmdParameters));
SecureKey result = null;
try {
result = exportKeyImpl(kek, key, keySpec);
evt.addMessage(new SimpleMsg("result", "Exported Key", 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 importPIN.
@Override
public EncryptedPIN importPIN(EncryptedPIN pinUnderKd1, T kd1) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<>();
cmdParameters.add(new SimpleMsg("parameter", "PIN under Data Key 1", pinUnderKd1));
cmdParameters.add(new SimpleMsg("parameter", "Data Key 1", kd1));
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Import PIN", cmdParameters));
EncryptedPIN result = null;
try {
result = importPINImpl(pinUnderKd1, kd1);
evt.addMessage(new SimpleMsg("result", "PIN under LMK", result));
} catch (Exception e) {
evt.addMessage(e);
throw e instanceof SMException ? (SMException) e : new SMException(e);
} finally {
Logger.log(evt);
}
return result;
}
Aggregations