use of org.jpos.util.LogEvent 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<Loggeable>();
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.toArray(new Loggeable[cmdParameters.size()])));
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.LogEvent in project jPOS by jpos.
the class BaseSMAdapter method generateKey.
@Override
public SecureDESKey generateKey(short keyLength, String keyType) throws SMException {
SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "Key Length", keyLength), new SimpleMsg("parameter", "Key Type", keyType) };
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Generate Key", cmdParameters));
SecureDESKey result = null;
try {
result = generateKeyImpl(keyLength, keyType);
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;
}
use of org.jpos.util.LogEvent in project jPOS by jpos.
the class BaseSMAdapter method importKey.
@Override
public SecureDESKey importKey(short keyLength, String keyType, byte[] encryptedKey, SecureDESKey kek, boolean checkParity) throws SMException {
SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "Key Length", keyLength), new SimpleMsg("parameter", "Key Type", keyType), new SimpleMsg("parameter", "Encrypted Key", encryptedKey), new SimpleMsg("parameter", "Key-Encrypting Key", kek), new SimpleMsg("parameter", "Check Parity", checkParity) };
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Import Key", cmdParameters));
SecureDESKey result = null;
try {
result = importKeyImpl(keyLength, keyType, encryptedKey, kek, checkParity);
evt.addMessage(new SimpleMsg("result", "Imported 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.LogEvent in project jPOS by jpos.
the class BaseSMAdapter method eraseOldLMK.
@Override
public void eraseOldLMK() throws SMException {
SimpleMsg[] cmdParameters = {};
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.LogEvent in project jPOS by jpos.
the class BaseSMAdapter method verifyCVC3.
/**
* @param imkcvc3 the issuer master key for generating and verifying CVC3
* @param accountNo The account number including BIN and the check digit
* @param acctSeqNo account sequence number, 2 decimal digits
* @param atc application transactin counter. This is used for ICC Master
* Key derivation. A 2 byte value must be supplied.
* @param upn unpredictable number. This is used for Session Key Generation
* A 4 byte value must be supplied.
* @param data track data
* @param mkdm ICC Master Key Derivation Method. If {@code null} specified
* is assumed.
* @param cvc3 dynamic Card Verification Code 3
* @return true if cvc3 is valid false if not
* @throws SMException
*/
@Override
public boolean verifyCVC3(SecureDESKey imkcvc3, String accountNo, String acctSeqNo, byte[] atc, byte[] upn, byte[] data, MKDMethod mkdm, String cvc3) throws SMException {
SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "imk-cvc3", imkcvc3 == null ? "" : imkcvc3), 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", "upn", upn == null ? "" : ISOUtil.hexString(upn)), new SimpleMsg("parameter", "data", data == null ? "" : ISOUtil.hexString(data)), new SimpleMsg("parameter", "mkd method", mkdm), new SimpleMsg("parameter", "cvc3", cvc3) };
LogEvent evt = new LogEvent(this, "s-m-operation");
evt.addMessage(new SimpleMsg("command", "Verify CVC3", cmdParameters));
try {
boolean r = verifyCVC3Impl(imkcvc3, accountNo, acctSeqNo, atc, upn, data, mkdm, cvc3);
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);
}
}
Aggregations