WorldpayCSE { public static boolean isValidPublicKey(String stringKey) { try { WPPublicKey.parseKey(stringKey); } catch (WPCSEInvalidPublicKey e) { LOGGER.log(Level.INFO, e.getMessage(), e); return false; } return true; } WorldpayCSE(); void setPublicKey(String publicKey); WPPublicKey getPublicKey(); void setPublicKey(WPPublicKey publicKey); static boolean isValidPublicKey(String stringKey); String encrypt(WPCardData cardData); static Set<Integer> validate(WPCardData data); static final String RSA_1_5; static final String A_256_GCM; static final String API_VERSION; static final String LIB_VERSION; static final String CHANNEL; }
@Test public void testIsValidPublicKeyPositive() throws Exception { boolean valid = WorldpayCSE.isValidPublicKey(validPublicKey); Assert.assertTrue(valid); }
@Test public void testIsValidPublicKeyNegative() throws Exception { boolean valid = WorldpayCSE.isValidPublicKey(invalidPublicKey); Assert.assertFalse(valid); }