Search in sources :

Example 21 with Loggeable

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);
    }
}
Also used : LogEvent(org.jpos.util.LogEvent) ArrayList(java.util.ArrayList) Loggeable(org.jpos.util.Loggeable) SimpleMsg(org.jpos.util.SimpleMsg) ConfigurationException(org.jpos.core.ConfigurationException) NotFoundException(org.jpos.util.NameRegistrar.NotFoundException)

Example 22 with Loggeable

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;
}
Also used : LogEvent(org.jpos.util.LogEvent) ArrayList(java.util.ArrayList) Loggeable(org.jpos.util.Loggeable) SimpleMsg(org.jpos.util.SimpleMsg) ConfigurationException(org.jpos.core.ConfigurationException) NotFoundException(org.jpos.util.NameRegistrar.NotFoundException)

Example 23 with Loggeable

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);
    }
}
Also used : LogEvent(org.jpos.util.LogEvent) ArrayList(java.util.ArrayList) Loggeable(org.jpos.util.Loggeable) SimpleMsg(org.jpos.util.SimpleMsg) ConfigurationException(org.jpos.core.ConfigurationException) NotFoundException(org.jpos.util.NameRegistrar.NotFoundException)

Example 24 with Loggeable

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;
}
Also used : LogEvent(org.jpos.util.LogEvent) ArrayList(java.util.ArrayList) Loggeable(org.jpos.util.Loggeable) SimpleMsg(org.jpos.util.SimpleMsg) ConfigurationException(org.jpos.core.ConfigurationException) NotFoundException(org.jpos.util.NameRegistrar.NotFoundException)

Example 25 with Loggeable

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;
}
Also used : LogEvent(org.jpos.util.LogEvent) ArrayList(java.util.ArrayList) Loggeable(org.jpos.util.Loggeable) SimpleMsg(org.jpos.util.SimpleMsg) ConfigurationException(org.jpos.core.ConfigurationException) NotFoundException(org.jpos.util.NameRegistrar.NotFoundException)

Aggregations

Loggeable (org.jpos.util.Loggeable)56 ArrayList (java.util.ArrayList)55 LogEvent (org.jpos.util.LogEvent)55 SimpleMsg (org.jpos.util.SimpleMsg)55 ConfigurationException (org.jpos.core.ConfigurationException)53 NotFoundException (org.jpos.util.NameRegistrar.NotFoundException)53 PublicKey (java.security.PublicKey)2 Iterator (java.util.Iterator)1 Map (java.util.Map)1 NameRegistrar (org.jpos.util.NameRegistrar)1