use of org.jpos.util.Loggeable in project jPOS by jpos.
the class BaseSMAdapter method decryptPIN.
@Override
public String decryptPIN(EncryptedPIN pinUnderLmk) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<>();
cmdParameters.add(new SimpleMsg("parameter", "PIN under LMK", pinUnderLmk));
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Decrypt PIN", cmdParameters));
String result = null;
try {
result = decryptPINImpl(pinUnderLmk);
evt.addMessage(new SimpleMsg("result", "clear 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 exportPIN.
@Override
public EncryptedPIN exportPIN(EncryptedPIN pinUnderLmk, T kd2, byte destinationPINBlockFormat) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<>();
cmdParameters.add(new SimpleMsg("parameter", "PIN under LMK", pinUnderLmk));
cmdParameters.add(new SimpleMsg("parameter", "Data Key 2", kd2));
cmdParameters.add(new SimpleMsg("parameter", "Destination PIN Block Format", destinationPINBlockFormat));
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Export PIN", cmdParameters));
EncryptedPIN result = null;
try {
result = exportPINImpl(pinUnderLmk, kd2, destinationPINBlockFormat);
evt.addMessage(new SimpleMsg("result", "PIN under Data Key 2", 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 generateKeyPair.
@Override
public Pair<PublicKey, SecureKey> generateKeyPair(SecureKeySpec keySpec) throws SMException {
List<Loggeable> cmdParameters = new ArrayList<>();
cmdParameters.add(new SimpleMsg("parameter", "Key Pair Specification", keySpec));
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Generate public/private key pair", cmdParameters));
Pair<PublicKey, SecureKey> result = null;
try {
result = generateKeyPairImpl(keySpec);
List<Loggeable> cmdResults = new ArrayList<>();
cmdResults.add(new SimpleMsg("result", "Public Key", result.getValue0().getEncoded()));
cmdResults.add(new SimpleMsg("result", "Private Key", result.getValue1().getKeyBytes()));
evt.addMessage(new SimpleMsg("results", "Complex results", cmdResults));
} 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 eraseOldLMK.
@Override
public void eraseOldLMK() throws SMException {
List<Loggeable> cmdParameters = new ArrayList<>();
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Erase the key change storage", cmdParameters));
try {
eraseOldLMKImpl();
} 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 generateSM_MAC.
@Override
public byte[] generateSM_MAC(MKDMethod mkdm, SKDMethod skdm, T imksmi, String accountNo, String acctSeqNo, byte[] atc, byte[] arqc, byte[] data) 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-smi", imksmi));
cmdParameters.add(new SimpleMsg("parameter", "account number", accountNo));
cmdParameters.add(new SimpleMsg("parameter", "accnt seq no", acctSeqNo));
cmdParameters.add(new SimpleMsg("parameter", "atc", atc == null ? "" : ISOUtil.hexString(atc)));
cmdParameters.add(new SimpleMsg("parameter", "arqc", arqc == null ? "" : ISOUtil.hexString(arqc)));
cmdParameters.add(new SimpleMsg("parameter", "data", data == null ? "" : ISOUtil.hexString(data)));
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Generate Secure Messaging MAC", cmdParameters));
try {
byte[] mac = generateSM_MACImpl(mkdm, skdm, imksmi, accountNo, acctSeqNo, atc, arqc, data);
evt.addMessage(new SimpleMsg("result", "Generated MAC", mac != null ? ISOUtil.hexString(mac) : ""));
return mac;
} catch (Exception e) {
evt.addMessage(e);
throw e instanceof SMException ? (SMException) e : new SMException(e);
} finally {
Logger.log(evt);
}
}
Aggregations