Search in sources :

Example 46 with SimpleMsg

use of org.jpos.util.SimpleMsg in project jPOS by jpos.

the class BaseSMAdapter method printPIN.

@Override
public void printPIN(String accountNo, EncryptedPIN pinUnderKd1, SecureDESKey kd1, String template, Map<String, String> fields) throws SMException {
    List<Loggeable> cmdParameters = new ArrayList<Loggeable>();
    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.toArray(new Loggeable[0])));
    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 47 with SimpleMsg

use of org.jpos.util.SimpleMsg in project jPOS by jpos.

the class BaseSMAdapter method verifyARQCGenerateARPC.

@Override
public byte[] verifyARQCGenerateARPC(MKDMethod mkdm, SKDMethod skdm, SecureDESKey imkac, String accoutNo, String acctSeqNo, byte[] arqc, byte[] atc, byte[] upn, byte[] transData, ARPCMethod arpcMethod, byte[] arc, byte[] propAuthData) throws SMException {
    SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "mkd method", mkdm), new SimpleMsg("parameter", "skd method", skdm), new SimpleMsg("parameter", "imk-ac", imkac), new SimpleMsg("parameter", "account number", accoutNo), new SimpleMsg("parameter", "accnt seq no", acctSeqNo), new SimpleMsg("parameter", "arqc", arqc == null ? "" : ISOUtil.hexString(arqc)), new SimpleMsg("parameter", "atc", atc == null ? "" : ISOUtil.hexString(atc)), new SimpleMsg("parameter", "upn", upn == null ? "" : ISOUtil.hexString(upn)), new SimpleMsg("parameter", "trans. data", transData == null ? "" : ISOUtil.hexString(transData)), new SimpleMsg("parameter", "arpc gen. method", arpcMethod), new SimpleMsg("parameter", "auth. rc", arc == null ? "" : ISOUtil.hexString(arc)), new SimpleMsg("parameter", "prop auth. data", propAuthData == null ? "" : ISOUtil.hexString(propAuthData)) };
    LogEvent evt = new LogEvent(this, "s-m-operation");
    evt.addMessage(new SimpleMsg("command", "Genarate ARPC", cmdParameters));
    try {
        byte[] result = verifyARQCGenerateARPCImpl(mkdm, skdm, imkac, accoutNo, acctSeqNo, arqc, atc, upn, transData, arpcMethod, arc, propAuthData);
        evt.addMessage(new SimpleMsg("result", "ARPC", result == null ? "" : ISOUtil.hexString(result)));
        return result;
    } 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) SimpleMsg(org.jpos.util.SimpleMsg) ConfigurationException(org.jpos.core.ConfigurationException) NotFoundException(org.jpos.util.NameRegistrar.NotFoundException)

Example 48 with SimpleMsg

use of org.jpos.util.SimpleMsg in project jPOS by jpos.

the class BaseSMAdapter method verifydCVV.

@Override
public boolean verifydCVV(String accountNo, SecureDESKey imkac, String dcvv, Date expDate, String serviceCode, byte[] atc, MKDMethod mkdm) throws SMException {
    SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "account number", accountNo), new SimpleMsg("parameter", "imk-ac", imkac == null ? "" : imkac), new SimpleMsg("parameter", "dCVV", dcvv), new SimpleMsg("parameter", "Exp date", expDate), new SimpleMsg("parameter", "Service code", serviceCode), new SimpleMsg("parameter", "atc", atc == null ? "" : ISOUtil.hexString(atc)), new SimpleMsg("parameter", "mkd method", mkdm) };
    LogEvent evt = new LogEvent(this, "s-m-operation");
    evt.addMessage(new SimpleMsg("command", "Verify dCVV", cmdParameters));
    try {
        boolean r = verifydCVVImpl(accountNo, imkac, dcvv, expDate, serviceCode, atc, mkdm);
        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) SimpleMsg(org.jpos.util.SimpleMsg) ConfigurationException(org.jpos.core.ConfigurationException) NotFoundException(org.jpos.util.NameRegistrar.NotFoundException)

Example 49 with SimpleMsg

use of org.jpos.util.SimpleMsg in project jPOS by jpos.

the class BaseSMAdapter method verifyARQC.

@Override
public boolean verifyARQC(MKDMethod mkdm, SKDMethod skdm, SecureDESKey imkac, String accoutNo, String acctSeqNo, byte[] arqc, byte[] atc, byte[] upn, byte[] transData) throws SMException {
    SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "mkd method", mkdm), new SimpleMsg("parameter", "skd method", skdm), new SimpleMsg("parameter", "imk-ac", imkac), new SimpleMsg("parameter", "account number", accoutNo), new SimpleMsg("parameter", "accnt seq no", acctSeqNo), new SimpleMsg("parameter", "arqc", arqc == null ? "" : ISOUtil.hexString(arqc)), new SimpleMsg("parameter", "atc", atc == null ? "" : ISOUtil.hexString(atc)), new SimpleMsg("parameter", "upn", upn == null ? "" : ISOUtil.hexString(upn)), new SimpleMsg("parameter", "trans. data", transData == null ? "" : ISOUtil.hexString(transData)) };
    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, transData);
        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) SimpleMsg(org.jpos.util.SimpleMsg) ConfigurationException(org.jpos.core.ConfigurationException) NotFoundException(org.jpos.util.NameRegistrar.NotFoundException)

Example 50 with SimpleMsg

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

Aggregations

LogEvent (org.jpos.util.LogEvent)76 SimpleMsg (org.jpos.util.SimpleMsg)76 ConfigurationException (org.jpos.core.ConfigurationException)72 NotFoundException (org.jpos.util.NameRegistrar.NotFoundException)72 ArrayList (java.util.ArrayList)55 Loggeable (org.jpos.util.Loggeable)55 PublicKey (java.security.PublicKey)2 SecretKey (javax.crypto.SecretKey)2