use of org.jpos.security.EncryptedPIN in project jPOS by jpos.
the class JCESecurityModuleTest method testImportPINImplFormat05Other.
@Test
public void testImportPINImplFormat05Other() throws Throwable {
EncryptedPIN pinUnderZPKfmt05 = new EncryptedPIN("07438C40F225BF7D", SMAdapter.FORMAT05, "0210987654321");
EncryptedPIN ep = jcesecmod.importPINImpl(pinUnderZPKfmt05, zpk);
String pin = jcesecmod.decryptPINImpl(ep);
assertEquals("1234", pin);
}
use of org.jpos.security.EncryptedPIN in project jPOS by jpos.
the class JCESecurityModuleTest method testTranslatePINImpl.
@Test
public void testTranslatePINImpl() throws Throwable {
EncryptedPIN pinUnderZPK = new EncryptedPIN("3C0CA40863092C3A", SMAdapter.FORMAT01, "1234567890120");
EncryptedPIN pinUnderTPK = jcesecmod.translatePINImpl(pinUnderZPK, zpk, tpk, SMAdapter.FORMAT01);
// Clear keys are that same so after translation expected result must be unchanged
byte[] expected = ISOUtil.hex2byte("3C0CA40863092C3A");
assertArrayEquals(expected, pinUnderTPK.getPINBlock());
assertEquals(SMAdapter.FORMAT01, pinUnderTPK.getPINBlockFormat());
assertEquals("123456789012", pinUnderTPK.getAccountNumber());
}
use of org.jpos.security.EncryptedPIN in project jPOS by jpos.
the class JCESecurityModuleTest method testImportPINImpl.
@Test
public void testImportPINImpl() throws Throwable {
EncryptedPIN pinUnderKd1 = new EncryptedPIN("3C0CA40863092C3A", SMAdapter.FORMAT01, "1234567890120");
EncryptedPIN ep = jcesecmod.importPINImpl(pinUnderKd1, zpk);
String pin = jcesecmod.decryptPINImpl(ep);
assertEquals("1234", pin);
}
use of org.jpos.security.EncryptedPIN in project jPOS by jpos.
the class JCESecurityModuleTest method testEncryptPINImpl1.
@Test
public void testEncryptPINImpl1() throws Throwable {
EncryptedPIN ep = jcesecmod.encryptPINImpl("123456789012", "12Characters");
byte[] expected = ISOUtil.hex2byte("B7D085B0EB9E0956");
assertArrayEquals(expected, ep.getPINBlock());
assertEquals(SMAdapter.FORMAT00, ep.getPINBlockFormat());
}
use of org.jpos.security.EncryptedPIN 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());
}
}
Aggregations