Search in sources :

Example 11 with SecureDESKey

use of org.jpos.security.SecureDESKey in project jPOS by jpos.

the class JCESecurityModuleTest method testExportPINImplThrowsNullPointerException.

@Test
public void testExportPINImplThrowsNullPointerException() throws Throwable {
    try {
        new JCESecurityModule().exportPINImpl(null, new SecureDESKey(), (byte) 0);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : SecureDESKey(org.jpos.security.SecureDESKey) Test(org.junit.Test)

Example 12 with SecureDESKey

use of org.jpos.security.SecureDESKey in project jPOS by jpos.

the class JCESecurityModuleTest method testTranslatePINImplThrowsNullPointerException1.

@Test
public void testTranslatePINImplThrowsNullPointerException1() throws Throwable {
    byte[] keyBytes = new byte[0];
    try {
        new JCESecurityModule().translatePINImpl(new EncryptedPIN(), new SecureDESKey((short) 100, "testJCESecurityModuleKeyType", keyBytes, "testString".getBytes()), new SecureDESKey(), (byte) 0);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : SecureDESKey(org.jpos.security.SecureDESKey) EncryptedPIN(org.jpos.security.EncryptedPIN) Test(org.junit.Test)

Example 13 with SecureDESKey

use of org.jpos.security.SecureDESKey in project jPOS by jpos.

the class JCESecurityModuleTest method testExportKeyImplThrowsNullPointerException1.

@Test
public void testExportKeyImplThrowsNullPointerException1() throws Throwable {
    try {
        new JCESecurityModule().exportKeyImpl(new SecureDESKey((short) 100, "testJCESecurityModuleKeyType", "testJCESecurityModuleKeyHexString1", "testJCESecurityModuleKeyCheckValueHexString1"), new SecureDESKey());
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : SecureDESKey(org.jpos.security.SecureDESKey) Test(org.junit.Test)

Example 14 with SecureDESKey

use of org.jpos.security.SecureDESKey in project jPOS by jpos.

the class JCESecurityModuleTest method testCalculatePVVImpl1.

@Test
public void testCalculatePVVImpl1() throws Throwable {
    // pvk and zpk are same type
    SecureDESKey pvk = tpk;
    int pvki = 0;
    String pvv = jcesecmod.calculatePVV(pinUnderLMK, pvk, null, pvki);
    String expected = "1226";
    assertEquals(expected, pvv);
}
Also used : SecureDESKey(org.jpos.security.SecureDESKey) Test(org.junit.Test)

Example 15 with SecureDESKey

use of org.jpos.security.SecureDESKey in project jPOS by jpos.

the class JCESecurityModuleTest method testExportKeyImplThrowsNullPointerException.

@Test
public void testExportKeyImplThrowsNullPointerException() throws Throwable {
    try {
        new JCESecurityModule().exportKeyImpl(null, new SecureDESKey((short) 100, "testJCESecurityModuleKeyType", "testJCESecurityModuleKeyHexString1", "testJCESecurityModuleKeyCheckValueHexString1"));
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : SecureDESKey(org.jpos.security.SecureDESKey) Test(org.junit.Test)

Aggregations

SecureDESKey (org.jpos.security.SecureDESKey)16 Test (org.junit.Test)13 EncryptedPIN (org.jpos.security.EncryptedPIN)4 ConfigurationException (org.jpos.core.ConfigurationException)2 Properties (java.util.Properties)1 SimpleConfiguration (org.jpos.core.SimpleConfiguration)1 SMException (org.jpos.security.SMException)1 LogEvent (org.jpos.util.LogEvent)1 Logger (org.jpos.util.Logger)1 SimpleLogListener (org.jpos.util.SimpleLogListener)1