Search in sources :

Example 6 with SecureDESKey

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

the class JCESecurityModuleTest method testImportPINImplThrowsNullPointerException2.

@Test
public void testImportPINImplThrowsNullPointerException2() throws Throwable {
    try {
        new JCESecurityModule().importPINImpl(null, 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 7 with SecureDESKey

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

the class JCESecurityModuleTest method testTranslatePINImplThrowsNullPointerException.

@Test
public void testTranslatePINImplThrowsNullPointerException() throws Throwable {
    try {
        new JCESecurityModule().translatePINImpl(new EncryptedPIN("testString".getBytes(), (byte) 0, "testJCESecurityModuleAccountNumber"), 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) EncryptedPIN(org.jpos.security.EncryptedPIN) Test(org.junit.Test)

Example 8 with SecureDESKey

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

the class JCESecurityModuleTest method testTranslatePINImplThrowsNullPointerException2.

@Test
public void testTranslatePINImplThrowsNullPointerException2() throws Throwable {
    byte[] keyBytes = new byte[0];
    try {
        new JCESecurityModule().translatePINImpl(null, 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) Test(org.junit.Test)

Example 9 with SecureDESKey

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

the class JCESecurityModuleTest method translateKeySchemeImpl_Same.

@Test
public void translateKeySchemeImpl_Same() throws Throwable {
    SecureDESKey conv = jcesecmod.translateKeySchemeImpl(zpk, KeyScheme.U);
    assertEquals(zpk.getKeyLength(), conv.getKeyLength());
    assertEquals(zpk.getKeyType(), conv.getKeyType());
    Assert.assertArrayEquals(zpk.getKeyCheckValue(), conv.getKeyCheckValue());
    Assert.assertEquals(KeyScheme.U, zpk.getScheme());
    Assert.assertEquals(zpk.getVariant(), zpk.getVariant());
}
Also used : SecureDESKey(org.jpos.security.SecureDESKey) Test(org.junit.Test)

Example 10 with SecureDESKey

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

the class JCESecurityModuleTest method testImportKeyImplThrowsNullPointerException.

@Test
public void testImportKeyImplThrowsNullPointerException() throws Throwable {
    byte[] encryptedKey = new byte[2];
    try {
        new JCESecurityModule().importKeyImpl((short) 100, "testJCESecurityModuleKeyType", encryptedKey, new SecureDESKey((short) 100, "testJCESecurityModuleKeyType", "testJCESecurityModuleKeyHexString1", "testJCESecurityModuleKeyCheckValueHexString1"), true);
        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