Search in sources :

Example 51 with Loggeable

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

the class BaseSMAdapter method generateKeyCheckValue.

@Override
public byte[] generateKeyCheckValue(T kd) throws SMException {
    List<Loggeable> cmdParameters = new ArrayList<>();
    cmdParameters.add(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;
}
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 52 with Loggeable

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

the class BaseSMAdapter method importKey.

@Override
public SecureKey importKey(SecureKey kek, SecureKey key, SecureKeySpec keySpec, boolean checkParity) throws SMException {
    List<Loggeable> cmdParameters = new ArrayList<>();
    cmdParameters.add(new SimpleMsg("parameter", "Key-Encrypting Key", kek));
    cmdParameters.add(new SimpleMsg("parameter", "Encrypted Key", key));
    cmdParameters.add(new SimpleMsg("parameter", "Key Specification", keySpec));
    cmdParameters.add(new SimpleMsg("parameter", "Check Parity", checkParity));
    LogEvent evt = new LogEvent(this, "s-m-operation");
    evt.addMessage(new SimpleMsg("command", "Import Key", cmdParameters));
    SecureKey result = null;
    try {
        result = importKeyImpl(kek, key, keySpec, 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;
}
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 53 with Loggeable

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

the class BaseSMAdapter method translateKeyScheme.

@Override
public SecureDESKey translateKeyScheme(SecureDESKey key, KeyScheme destKeyScheme) throws SMException {
    List<Loggeable> cmdParameters = new ArrayList<>();
    cmdParameters.add(new SimpleMsg("parameter", "Key", key));
    cmdParameters.add(new SimpleMsg("parameter", "Destination Key Scheme", destKeyScheme));
    LogEvent evt = new LogEvent(this, "s-m-operation");
    evt.addMessage(new SimpleMsg("command", "Translate Key Scheme", cmdParameters));
    SecureDESKey result = null;
    try {
        result = translateKeySchemeImpl(key, destKeyScheme);
        evt.addMessage(new SimpleMsg("result", "Translate Key Scheme", 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 54 with Loggeable

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

the class BaseSMAdapter method translatePIN.

@Override
public EncryptedPIN translatePIN(EncryptedPIN pinUnderDuk, KeySerialNumber ksn, T bdk, T kd2, byte destinationPINBlockFormat, boolean tdes) throws SMException {
    List<Loggeable> cmdParameters = new ArrayList<>();
    cmdParameters.add(new SimpleMsg("parameter", "PIN under Derived Unique Key", pinUnderDuk));
    cmdParameters.add(new SimpleMsg("parameter", "Key Serial Number", ksn));
    cmdParameters.add(new SimpleMsg("parameter", "Base Derivation Key", bdk));
    cmdParameters.add(new SimpleMsg("parameter", "Data Key 2", kd2));
    cmdParameters.add(new SimpleMsg("parameter", "Destination PIN Block Format", destinationPINBlockFormat));
    LogEvent evt = new LogEvent(this, "s-m-operation");
    evt.addMessage(new SimpleMsg("command", "Translate PIN", cmdParameters));
    EncryptedPIN result = null;
    try {
        result = translatePINImpl(pinUnderDuk, ksn, bdk, kd2, destinationPINBlockFormat, tdes);
        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;
}
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 55 with Loggeable

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

the class BaseSMAdapter method verifyCAVV.

@Override
public boolean verifyCAVV(String accountNo, T cvk, String cavv, String upn, String authrc, String sfarc) throws SMException {
    List<Loggeable> cmdParameters = new ArrayList<>();
    cmdParameters.add(new SimpleMsg("parameter", "account number", accountNo));
    cmdParameters.add(new SimpleMsg("parameter", "cvk", cvk == null ? "" : cvk));
    cmdParameters.add(new SimpleMsg("parameter", "cavv", cavv == null ? "" : cavv));
    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", "Verify CAVV/AAV", cmdParameters));
    boolean r = false;
    try {
        r = verifyCAVVImpl(accountNo, cvk, cavv, upn, authrc, sfarc);
        evt.addMessage(new SimpleMsg("result", "Verification status", r));
    } catch (Exception e) {
        evt.addMessage(e);
        throw e instanceof SMException ? (SMException) e : new SMException(e);
    } finally {
        Logger.log(evt);
    }
    return r;
}
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