use of org.jpos.util.SimpleMsg in project jPOS by jpos.
the class BaseSMAdapter method generateCBC_MAC.
@Override
public byte[] generateCBC_MAC(byte[] data, SecureDESKey kd) throws SMException {
SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "data", data), 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;
}
use of org.jpos.util.SimpleMsg in project jPOS by jpos.
the class BaseSMAdapter method exportPIN.
@Override
public EncryptedPIN exportPIN(EncryptedPIN pinUnderLmk, SecureDESKey kd2, byte destinationPINBlockFormat) throws SMException {
SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "PIN under LMK", pinUnderLmk), new SimpleMsg("parameter", "Data Key 2", kd2), 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.SimpleMsg in project jPOS by jpos.
the class BaseSMAdapter method generateKeyCheckValue.
@Override
public byte[] generateKeyCheckValue(SecureDESKey kd) throws SMException {
SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "Key with untrusted check value", kd) };
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Generate Key Check Value", cmdParameters));
byte[] result = null;
try {
result = generateKeyCheckValueImpl(kd);
evt.addMessage(new SimpleMsg("result", "Generated Key Check Value", ISOUtil.hexString(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.SimpleMsg in project jPOS by jpos.
the class BaseSMAdapter method generateSM_MAC.
@Override
public byte[] generateSM_MAC(MKDMethod mkdm, SKDMethod skdm, SecureDESKey imksmi, String accountNo, String acctSeqNo, byte[] atc, byte[] arqc, byte[] data) throws SMException {
SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "mkd method", mkdm), new SimpleMsg("parameter", "skd method", skdm), new SimpleMsg("parameter", "imk-smi", imksmi), new SimpleMsg("parameter", "account number", accountNo), new SimpleMsg("parameter", "accnt seq no", acctSeqNo), new SimpleMsg("parameter", "atc", atc == null ? "" : ISOUtil.hexString(atc)), new SimpleMsg("parameter", "arqc", arqc == null ? "" : ISOUtil.hexString(arqc)), 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);
}
}
use of org.jpos.util.SimpleMsg in project jPOS by jpos.
the class BaseSMAdapter method importPIN.
@Override
public EncryptedPIN importPIN(EncryptedPIN pinUnderDuk, KeySerialNumber ksn, SecureDESKey bdk, boolean tdes) throws SMException {
SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "PIN under Derived Unique Key", pinUnderDuk), new SimpleMsg("parameter", "Key Serial Number", ksn), new SimpleMsg("parameter", "Base Derivation Key", bdk) };
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Import PIN", cmdParameters));
EncryptedPIN result = null;
try {
result = importPINImpl(pinUnderDuk, ksn, bdk, tdes);
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