/** * Main method of this class to be used as a command-line tool to get a crypted version of a resource password. * @param args the command-line arguments. * @throws Exception when an error occurs crypting the given resource password. */ public static void main(String[] args) throws Exception { System.out.println("Bitronix Transaction Manager " + Version.getVersion() + " password property crypter"); System.out.flush(); if (args.length < 1 || args.length > 2) { System.err.println("Usage: CryptoEngine <password> [cipher]"); System.err.println(" where:"); System.err.println(" <password> is mandatory and is the resource password to crypt"); System.err.println(" [cipher] is optional and is the cipher to be used to crypt the password"); System.exit(1); } String data = args[0]; String cipher = "DES"; if (args.length > 1) cipher = args[1]; String propertyValue = "{" + cipher + "}" + crypt(cipher, data); System.out.println("crypted password property value: " + propertyValue); }
/** * Main method of this class to be used as a command-line tool to get a crypted version of a resource password. * @param args the command-line arguments. * @throws Exception when an error occurs crypting the given resource password. */ public static void main(String[] args) throws Exception { System.out.println("Bitronix Transaction Manager " + Version.getVersion() + " password property crypter"); System.out.flush(); if (args.length < 1 || args.length > 2) { System.err.println("Usage: CryptoEngine <password> [cipher]"); System.err.println(" where:"); System.err.println(" <password> is mandatory and is the resource password to crypt"); System.err.println(" [cipher] is optional and is the cipher to be used to crypt the password"); System.exit(1); } String data = args[0]; String cipher = "DES"; if (args.length > 1) cipher = args[1]; String propertyValue = "{" + cipher + "}" + crypt(cipher, data); System.out.println("crypted password property value: " + propertyValue); }
/** * Main method of this class to be used as a command-line tool to get a crypted version of a resource password. * @param args the command-line arguments. * @throws Exception when an error occurs crypting the given resource password. */ public static void main(String[] args) throws Exception { System.out.println("Bitronix Transaction Manager " + Version.getVersion() + " password property crypter"); System.out.flush(); if (args.length < 1 || args.length > 2) { System.err.println("Usage: CryptoEngine <password> [cipher]"); System.err.println(" where:"); System.err.println(" <password> is mandatory and is the resource password to crypt"); System.err.println(" [cipher] is optional and is the cipher to be used to crypt the password"); System.exit(1); } String data = args[0]; String cipher = "DES"; if (args.length > 1) cipher = args[1]; String propertyValue = "{" + cipher + "}" + crypt(cipher, data); System.out.println("crypted password property value: " + propertyValue); }
/** * Main method of this class to be used as a command-line tool to get a crypted version of a resource password. * @param args the command-line arguments. * @throws Exception when an error occurs crypting the given resource password. */ public static void main(String[] args) throws Exception { System.out.println("Bitronix Transaction Manager " + Version.getVersion() + " password property crypter"); System.out.flush(); if (args.length < 1 || args.length > 2) { System.err.println("Usage: CryptoEngine <password> [cipher]"); System.err.println(" where:"); System.err.println(" <password> is mandatory and is the resource password to crypt"); System.err.println(" [cipher] is optional and is the cipher to be used to crypt the password"); System.exit(1); } String data = args[0]; String cipher = "DES"; if (args.length > 1) cipher = args[1]; String propertyValue = "{" + cipher + "}" + crypt(cipher, data); System.out.println("crypted password property value: " + propertyValue); }
public void testCrypt() throws Exception { String textToCrypt = "java"; String cypherText = CryptoEngine.crypt("DES", textToCrypt); String decryptedText = CryptoEngine.decrypt("DES", cypherText); assertEquals(textToCrypt, decryptedText); }
public void testCrypt() throws Exception { String textToCrypt = "java"; String cypherText = CryptoEngine.crypt("DES", textToCrypt); String decryptedText = CryptoEngine.decrypt("DES", cypherText); assertEquals(textToCrypt, decryptedText); }
public void testBuildXAFactory() throws Exception { ResourceBean rb = new ResourceBean() {}; rb.setMaxPoolSize(1); rb.setClassName(MockitoXADataSource.class.getName()); rb.getDriverProperties().setProperty("userName", "java"); rb.getDriverProperties().setProperty("password", "{DES}" + CryptoEngine.crypt("DES", "java")); XAPool<DummyResourceHolder, DummyStatefulHolder> xaPool = new XAPool<DummyResourceHolder, DummyStatefulHolder>(null, rb, null); assertEquals(0, xaPool.totalPoolSize()); assertEquals(0, xaPool.inPoolSize()); MockitoXADataSource xads = (MockitoXADataSource) xaPool.getXAFactory(); assertEquals("java", xads.getUserName()); assertEquals("java", xads.getPassword()); }
public void testBuildXAFactory() throws Exception { ResourceBean rb = new ResourceBean() {}; rb.setMaxPoolSize(1); rb.setClassName(MockitoXADataSource.class.getName()); rb.getDriverProperties().setProperty("userName", "java"); rb.getDriverProperties().setProperty("password", "{DES}" + CryptoEngine.crypt("DES", "java")); XAPool<DummyResourceHolder, DummyStatefulHolder> xaPool = new XAPool<DummyResourceHolder, DummyStatefulHolder>(null, rb, null); assertEquals(0, xaPool.totalPoolSize()); assertEquals(0, xaPool.inPoolSize()); MockitoXADataSource xads = (MockitoXADataSource) xaPool.getXAFactory(); assertEquals("java", xads.getUserName()); assertEquals("java", xads.getPassword()); }