Search in sources :

Example 81 with LogEvent

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

the class BaseSMAdapter method translateKeyFromOldLMK.

@Override
public SecureDESKey translateKeyFromOldLMK(SecureDESKey kd) throws SMException {
    SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "Key under old LMK", kd) };
    LogEvent evt = new LogEvent(this, "s-m-operation");
    evt.addMessage(new SimpleMsg("command", "Translate Key from old to new LMK", cmdParameters));
    SecureDESKey result = null;
    try {
        result = translateKeyFromOldLMKImpl(kd);
        evt.addMessage(new SimpleMsg("result", "Translated Key under new 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) SimpleMsg(org.jpos.util.SimpleMsg) ConfigurationException(org.jpos.core.ConfigurationException) NotFoundException(org.jpos.util.NameRegistrar.NotFoundException)

Example 82 with LogEvent

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

the class BaseSMAdapter method decryptPIN.

@Override
public String decryptPIN(EncryptedPIN pinUnderLmk) throws SMException {
    SimpleMsg[] cmdParameters = { 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;
}
Also used : LogEvent(org.jpos.util.LogEvent) SimpleMsg(org.jpos.util.SimpleMsg) ConfigurationException(org.jpos.core.ConfigurationException) NotFoundException(org.jpos.util.NameRegistrar.NotFoundException)

Example 83 with LogEvent

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

the class BaseSMAdapter method deriveIBMPIN.

@Override
public EncryptedPIN deriveIBMPIN(String accountNo, SecureDESKey pvk, String decTab, String pinValData, int minPinLen, String offset) throws SMException {
    SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "account number", accountNo), new SimpleMsg("parameter", "Offset", offset), new SimpleMsg("parameter", "PVK", pvk), new SimpleMsg("parameter", "Decimalisation table", decTab), new SimpleMsg("parameter", "PIN validation data", pinValData), new SimpleMsg("parameter", "Minimum PIN length", minPinLen) };
    LogEvent evt = new LogEvent(this, "s-m-operation");
    evt.addMessage(new SimpleMsg("command", "Derive a PIN Using the IBM Method", cmdParameters));
    EncryptedPIN result = null;
    try {
        result = deriveIBMPINImpl(accountNo, pvk, decTab, pinValData, minPinLen, offset);
        evt.addMessage(new SimpleMsg("result", "Derived PIN", 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)

Example 84 with LogEvent

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

the class BaseSMAdapter method calculateCAVV.

@Override
public String calculateCAVV(String accountNo, SecureDESKey cvk, String upn, String authrc, String sfarc) throws SMException {
    List<Loggeable> cmdParameters = new ArrayList<Loggeable>();
    cmdParameters.add(new SimpleMsg("parameter", "account number", accountNo));
    cmdParameters.add(new SimpleMsg("parameter", "cvk", cvk == null ? "" : cvk));
    cmdParameters.add(new SimpleMsg("parameter", "unpredictable number", upn));
    cmdParameters.add(new SimpleMsg("parameter", "auth rc", authrc));
    cmdParameters.add(new SimpleMsg("parameter", "second factor auth rc", sfarc));
    LogEvent evt = new LogEvent(this, "s-m-operation");
    evt.addMessage(new SimpleMsg("command", "Calculate CAVV/AAV", cmdParameters));
    String result = null;
    try {
        result = calculateCAVVImpl(accountNo, cvk, upn, authrc, sfarc);
        evt.addMessage(new SimpleMsg("result", "Calculated CAVV/AAV", 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 85 with LogEvent

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

the class BaseSMAdapter method generateARPC.

@Override
public byte[] generateARPC(MKDMethod mkdm, SKDMethod skdm, SecureDESKey imkac, String accoutNo, String acctSeqNo, byte[] arqc, byte[] atc, byte[] upn, 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", "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 = generateARPCImpl(mkdm, skdm, imkac, accoutNo, acctSeqNo, arqc, atc, upn, arpcMethod, arc, propAuthData);
        evt.addMessage(new SimpleMsg("result", "Generated ARPC", 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)

Aggregations

LogEvent (org.jpos.util.LogEvent)189 Test (org.junit.Test)78 ConfigurationException (org.jpos.core.ConfigurationException)51 ISOMsg (org.jpos.iso.ISOMsg)41 SimpleMsg (org.jpos.util.SimpleMsg)40 NotFoundException (org.jpos.util.NameRegistrar.NotFoundException)38 ArrayList (java.util.ArrayList)24 IOException (java.io.IOException)18 SimpleConfiguration (org.jpos.core.SimpleConfiguration)14 CSChannel (org.jpos.iso.channel.CSChannel)12 Loggeable (org.jpos.util.Loggeable)11 Map (java.util.Map)9 ISOChannel (org.jpos.iso.ISOChannel)9 PostChannel (org.jpos.iso.channel.PostChannel)9 CTCSubFieldPackager (org.jpos.iso.packager.CTCSubFieldPackager)9 ISOFilter (org.jpos.iso.ISOFilter)8 BASE24TCPChannel (org.jpos.iso.channel.BASE24TCPChannel)8 PADChannel (org.jpos.iso.channel.PADChannel)8 ISOBaseValidatingPackager (org.jpos.iso.packager.ISOBaseValidatingPackager)8 EOFException (java.io.EOFException)7