antimatter/0000755000076600000240000000000011244251072012525 5ustar dkeenerstaffantimatter/.classpath0000644000076600000240000000056311241414364014516 0ustar dkeenerstaff antimatter/.project0000644000076600000240000000044511241414364014201 0ustar dkeenerstaff antimatter org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature antimatter/pom.xml0000644000076600000240000001110211241414364014037 0ustar dkeenerstaff 4.0.0 com.keenertech.antimatter antimatter jar 1.0-SNAPSHOT Antimatter http://www.keenertech.com/tools/antimatter Antimatter is a Java library containing useful utility functions for common project infrastructure tasks such as establishing database connections, performing encryption/decryption of strings and other tasks. org.jruby.extras goldspike 1.3 commons-codec commons-codec 20041127.091804 junit junit 3.8.1 test mysql mysql-connector-java 5.0.5 test src/main/resources true src/test/resources true src/site true src/test/resources true README.txt org.apache.maven.wagon wagon-ftp 1.0-alpha-6 org.apache.maven.plugins maven-compiler-plugin 1.5 1.5 KeenerTech Feedback http://www.keenertech.com/feedback antimatter.website ..\..\..\..\..\Stage\keenertech\antimatter  KeenerTech.com  http://www.keenertech.com Apache 2 http://www.apache.org/licenses/LICENSE-2.0.txt repo A business-friendly Open Source license. dkeener David Keener Architect KeenerTech.com -5 skeener2 Steve Keener Architect KeenerTech.com -5 Jake Vanus AOL Contributor -5 maven-javadoc-plugin org.apache.maven.plugins maven-jxr-plugin true target/site/apidocs org.codehaus.mojo taglist-maven-plugin org.apache.maven.plugins maven-surefire-report-plugin antimatter/README.txt0000644000076600000240000001036411244251027014227 0ustar dkeenerstaff Building Antimatter --------------------------------------------------------------- DATABASE SETTINGS A database is required in order to test an Antimatter build. When building with Maven 2, there is generally a local Maven 2 file where user-defined settings can be defined. Strangely enough, this file is called "settings.xml". It's typically the location where you put user-specific settings, like database connection settings, that don't otherwise belong in Antimatter's "pom.xml" file. Here's where "settings.xml" can be found: On Windows: C:\Documents and Settings\\.m2\settings.xml On a UNIX system: ~/.m2/settings.xml The easiest database to test your build with is MySQL. So, install MySQL (or the database system of your choice), and create a database with a user account and a password. Consult the vendor's documentation on how to do set up the database. OK. Now, you've successfully set up a local database...and it's currently running, right? Great. So, now record your database connection settings in the "settings.xml" file, as shown below: testdb true jdbc:mysql://localhost/yourdb com.mysql.jdbc.Driver your-username your-password Now, your're ready to build Antimatter. BUILDING ANTIMATTER To build Antimatter, simply run the following command: mvn package This will compile Antimatter and run all of the tests. The first time you run this command in your build environment, it will take longer than subsequent runs. This is because of the time required to download any dependencies that have been defined for Antimatter. The ibiblio.org site from which dependencies are downloaded may sometimes get busy enough to slow down the build process. This is unusual, but if it happens, you can either edit the "pom.xml" to use one of the mirrors instead, or you can wait and run that first build in the morning when the download repository is less busy. BUILDING THE ANTIMATTER DEV SITE To build the Antimatter development site, simply run the following command: mvn site This will create a sub-directory, "target/site", where the entire generated development site will be placed. To preview the development site, simply open up the top-level "index.html" file in your favorite browser. DEPLOYING THE ANTIMATTER DEV SITE Well, first, you're not going to be doing this unless you're one of the authorized core Antimatter developers. But if you are, well, the Antimatter development site is deployed as a sub-site of KeenerTech.com. There are some issues that make deploying to KeenerTech problematic. Ideally, the hosting company would support SSH. If they did, the SSH wagon (a type of component that provides transport services for Maven 2) could be used to easily deploy Antimatter directly to the web site (assuming suitable config settings were defined up in "pom.xml", which would be easy enough). Alas, AccuWebHosting, while otherwise a good hosting company, does not support SSH. Well, there is an FTP wagon for Maven 2, and AccuWebHosting does support FTP access. Unfortunately, there is a long-standing, and unresolved, problem with the FTP wagon. It cannot handle a directory tree, only individual files. Since SSH is not supported by the hosting company, and FTP is not adequately supported by Maven 2, the simple command below will NOT work: mvn site:deploy Onwards to the next alternative. Deploy the development site to a staging directory, from which it can then be uploaded to KeenerTech.com using a separate tool. To do this, run the following command: mvn site:stage The "pom.xml" is currently configured to stage the site to the following directory: c:\Keener\Stage\keenertech\antimatter From there, the Antimatter directory can be uploaded to the site using a tool like DreamWeaver. To create an Antimatter zip file: zip -j antimatter-1.0-SNAPSHOT.zip antimatter/* antimatter/src/0000755000076600000240000000000011244245521013316 5ustar dkeenerstaffantimatter/src/main/0000755000076600000240000000000011244245521014242 5ustar dkeenerstaffantimatter/src/main/java/0000755000076600000240000000000011244245521015163 5ustar dkeenerstaffantimatter/src/main/java/com/0000755000076600000240000000000011244245521015741 5ustar dkeenerstaffantimatter/src/main/java/com/keenertech/0000755000076600000240000000000011244245521020056 5ustar dkeenerstaffantimatter/src/main/java/com/keenertech/antimatter/0000755000076600000240000000000011244245521022226 5ustar dkeenerstaffantimatter/src/main/java/com/keenertech/antimatter/App.java0000644000076600000240000000027411241414363023613 0ustar dkeenerstaffpackage com.keenertech.antimatter; /** * Hello world! * */ public class App { public static void main( String[] args ) { System.out.println( "Hello World!" ); } } antimatter/src/main/java/com/keenertech/antimatter/BasicConnection.java0000644000076600000240000001253611241414363026140 0ustar dkeenerstaff// $Id: BasicConnection.java,v 1.2 2008/01/27 21:14:48 dkeener Exp $ package com.keenertech.antimatter; import java.io.FileInputStream; import java.util.Properties; import java.sql.SQLException; /** * The BasicConnection class is a wrapper around the standard Java Connection * class. The class inherits the functionality of the BasicDataSource class, * but adds other capabilities such as loading connection settings from a * properties file and decrypting the password to be used in creating a * connection to a data source. * * To create a connection to a database: * *
 *      BasicConnection objCon = new BasicConnection("c:\database.properties");
 *      objCon.establishConnection();
 * 
*/ public class BasicConnection extends BasicDataSource { protected String strConfigFile = null; protected Encrypter objEncrypter = null; /** * This default constructor creates an empty BasicConnection object. */ public BasicConnection() { } // End Constructor /** * This constructor creates a BasicConnection instance initialized using * the settings in the specified properties file. The properties file is * expected to be similar to the one shown in the example below. Note that * the order of the settings within a property file is not important. * *
* driver=com.mysql.jdbc.Driver
* url=jdbc:mysql://localhost:3306/yourdb
* user=someuser
* password=somepassword
*
* * This constructor embodies certain implicit assumptions. Specifically, since * no Encrypter object has been passed in, the class must assume that the password * in the properties file has not been encrypted. * * @param strFileName The full path of a properties file containing * connection information. */ public BasicConnection(String strFileName) { loadConfig(strFileName); } // End Constructor /** * This constructor reads connection settings from a properties file using * an Encrypter object to decrypt the password. * * @param strFileName The full pathname of a properties file. * * @param objEncrypter An Ecnrypter object which can be used to decrypt * the password. */ public BasicConnection(String strFileName, Encrypter objEncrypter) { this.objEncrypter = objEncrypter; loadConfig(strFileName); } // End Constructor /** * Reads connection settings from a properties file. The properties file is * read using the Properties class. * *

The password for the data source may be stored in the file as either an * encrypted string or as a non-encrypted string. This method has no intrinsic * knowledge as to whether the password is encrypted or not. Therefore, the * method assumes the caller has this knowledge. If the caller has previously * defined an Encrypter object, either via a constructor or using the * setEncrypter() method, then the assumption is that the password is encrypted, * and the specified Encrypter object will be used to decrypt the password. If * no Encrypter object has been defined, then the method assumes that the * password is being provided in clear text within the properties file (not a * recommended procedure). * * @param strFileName The full physical path of the configuration file. * * @return Returns TRUE for success, FALSE for failure. */ public boolean loadConfig(String strFileName) { boolean bSuccessful = true; this.strConfigFile = strFileName; try { Properties properties = new Properties(); String strEncryptedPassword = null; // Load the properties properties.load(new FileInputStream(strFileName)); // Get the properties from the Properties object this.DriverClassName = properties.getProperty("driver"); this.Url = properties.getProperty("url"); this.UserName = properties.getProperty("user"); // Handle the encrypted password strEncryptedPassword = properties.getProperty("password"); if (this.objEncrypter == null) { // The password is assumed to be unencrypted since no // Encrypter object has been defined. this.Password = strEncryptedPassword; // It's not encrypted } else { // The password is assumed to be encrypted since an Encrypter // object HAS been defined. this.Password = objEncrypter.decrypt(strEncryptedPassword); } } catch (Exception e) { System.out.print("BasicConnection.loadProperties: Error: Could not "); System.out.print("read connection settings from properties file: "); System.out.println(strFileName); bSuccessful = false; } return bSuccessful; } // End Method /** * Defines an Encrypter object to be used to decrypt connection-related * passwords. Passwords may be stored in properties files in an encrypted * form. * * @param objEncrypter - An Encrypter object. */ public void setEncrypter(Encrypter objEncrypter) { this.objEncrypter = objEncrypter; } // End Method } // End Class antimatter/src/main/java/com/keenertech/antimatter/BasicDataSource.java0000644000076600000240000001371211241414363026070 0ustar dkeenerstaffpackage com.keenertech.antimatter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; /** * The BasicDataSource class represents a data source, generally a relational database, * from which data may be retrieved once a connection has been established. * *

This class can easily be used to create database connections as needed. However, * consider using the BasicConnection class, which encapulates this class and provides * additional features for handling connection settings in property files (including * an encrypted password capability). */ public class BasicDataSource { protected String DriverClassName; protected String Url; protected String UserName; protected String Password; private Connection connection = null; /** * The default constructor. Required connection parameters must be defined before the * establishConnection() method can be called to successfully create a connection to * a data source. */ public BasicDataSource() { } // End Constructor /** * This constructor creates a BasicDataSource with all required connection parameters * already defined. Simply call the establishConnection() method to create a new * connection to the specified data source. * * @param className The name of the class. * @param url A URL describing the location and (optionally) parameters * required for the data source. * * @param userName The user name to be used to login to the data source. * * @param password The password to be used to login to the data source. */ public BasicDataSource(String className, String url, String userName, String password) { this.DriverClassName = className; this.Url = url; this.UserName = userName; this.Password = password; } // End Constructor public void setDriverClass(String className) { this.DriverClassName = className; } public String getDriverClass() { return this.DriverClassName; } public void setDataSourceURL(String url) { this.Url = url; } public String getDataSourceURL() { return this.Url; } public void setUserName(String userName) { this.UserName = userName; } public String getUserName() { return this.UserName; } public void setPassword(String password) { this.Password = password; } public String getPassword() { return this.Password; } public Connection getConnection() { return connection; } /** * This method explicitly sets the connection that is managed by an instance * of this class. If the instance already has an open connection, then that * connection will be automatically closed. */ public void setConnection(Connection connection) { close(); this.connection = connection; } // End Method /** * This method is used to establish a connection to the data source. In order to * sucessfully create a connection, required database settings must have been * previously set for an instance of this class by either 1) calling a constructor * that accepts the required settings as parameters, or 2) using the default * constructor and explicitly defining the settings. * *

To establish a connection, an instance of this class will try to load * the necessary driver class from the currently defined classpath. * * @return Returns TRUE if the database connection was successfully established, * or FALSE otherwise. */ public boolean establishConnection() { Connection conn = null; try { System.out.println("BasicDataSource: getConnection - Simple loader [" + DriverClassName + "]"); Class.forName(DriverClassName); } catch (Exception e) { System.out.println("BasicDataSource: getConnection - Failed to get db connection with first classloader."); return false; } try { System.out.println("BasicDataSource: getConnection: " + Url + ", " + UserName + ", " + Password); connection = DriverManager.getConnection(Url, UserName, Password); } catch (Exception e) { System.out.println("BasicDataSource: getConnection - GetConnection Failed."); e.printStackTrace (); return false; } return true; } // End Method /** * This method closes the database connection. It only attempts to close a connection if * one has been successfully established. */ public void close() { try { if (connection != null) { System.out.println("BasicDataSource: Closing database connection."); connection.close(); connection = null; } } catch (SQLException e) { e.printStackTrace(); } } // End Method /** * This method returns TRUE if no connection is active, or * FALSE otherwise. * * @return Returns TRUE if there is no active connection. Otherwise, * it returns FALSE. */ public boolean isClosed() { if (connection != null) { return false; } return true; } // End Method /** * This method returns TRUE if the connection is active, or * FALSE otherwise. * * @return Returns TRUE if there is an active connection. Otherwise, * it returns FALSE. */ public boolean isOpen() { return (! isClosed()); } // End Method public void logInfo() { System.out.println("BasicDataSource Classname [" + this.DriverClassName + "]"); System.out.println("BasicDataSource URL [" + this.Url + "]"); System.out.println("BasicDataSource UserName [" + this.UserName + "]"); System.out.println("BasicDataSource Password [" + this.Password + "]"); } // End Method } // End Classantimatter/src/main/java/com/keenertech/antimatter/Database.java0000644000076600000240000000602311241414363024575 0ustar dkeenerstaff// $Id: Database.java,v 1.1 2008/02/01 07:53:18 dkeener Exp $ package com.keenertech.antimatter; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; /** * The Database class includes utility functions for manipulating objects within * a relational database. The class features capabilities such as listing all of * the tables in a database, listing all of the columns within a table, exporting * data from one or more tables, etc. * * @author Steve Keener * @author David Keener */ public class Database { private final String strDefaultTableQuery = "show tables "; private final String strAltTableQuery = "sp_help"; private Connection objCon = null; /** * Default constructor. The database connection will need to be set using the * setConnection() method before any utility methods can be exercised. */ protected Database() { } // End Method /** * Creates a Database instance with a configured database connection. */ protected Database(Connection cn) { this.objCon = cn; } // End Method /** * Creates a Database instance with a configured database connection. */ protected Database(BasicDataSource ds) { this.objCon = ds.getConnection(); } // End Method /** * Gets a list of the tables within a database. * * @return Returns an ArrayList, where each entry in the ArrayList is a * String detailing the name of a table in the database. If a * failure occurs, then NULL will be returned. */ public ArrayList getTablesList() { // Try to get the list of tables using the default query, which works with // databases like MySQL, Oracle, etc. ArrayList tables = getTablesList(objCon, strDefaultTableQuery); return tables; } // End Method protected ArrayList getTablesList(Connection cn, String strQuery) { if (cn == null) { return null; } ArrayList tables = new ArrayList(); try { System.out.println("Tables: getTablesList - Querying for tables [" + strQuery + "]"); Statement stmt = cn.createStatement(); ResultSet rs = stmt.executeQuery(strQuery); int i = 0; while (rs.next()) { String s = rs.getString(1); System.out.println("Tables: getTablesList - TABLE [" + s + "]"); tables.add(s); } rs.close(); // All done with that resultset stmt.close(); // All done with that statement } catch (SQLException e) { System.out.println("Tables: getTablesList - Database query failed " + e); System.out.println("Tables: getTablesList - Failed query [" + strQuery + "]"); return null; } return tables; } // End Method } // End Classantimatter/src/main/java/com/keenertech/antimatter/Encrypter.java0000644000076600000240000004006711241414363025052 0ustar dkeenerstaff// $Id: Encrypter.java,v 1.6 2007/12/31 22:37:00 dkeener Exp $ package com.keenertech.antimatter; import java.io.UnsupportedEncodingException; import java.io.IOException; import java.security.NoSuchAlgorithmException; import java.security.InvalidKeyException; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.IllegalBlockSizeException; import javax.crypto.BadPaddingException; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Base64; // Replaced unsupported Sun Base64 functionality with Apache version // import sun.misc.BASE64Encoder; // import sun.misc.BASE64Decoder; /** * The Encrypter class provides for the encryption and decryption * of text strings using the robust and well-supported encryption algorithms * supported by JCE (Java Cryptographic Extensions), an implementation of * the JCA (Java Cryptography Architecture). The JCE is included with the * Java JDK, and should thus be readily available within most development * environments. Encrypted text can be binary and is thus further encoded * in base64 for easy transport as strings. * *

The Encrypter class should meet most encryption/decryption needs, * but has not particularly been designed with speed in mind. It is ideal * for encrypting vital fields, such as passwords, for use in configuration * files or configuration fields in a database. * *

The following code provides an example of how to use the class to * first encrypt and then decrypt a string:

* *
 *       String strContent = "clarke";
 *
 *       // Encrypt the string using the DES algorithm, with the key provided
 *       Encrypter objEncrypter = new Encrypter("A345B2Nu", "DES");
 *       String strEncrypted = objEncrypter.encrypt(strContent);
 *
 *       // Now create another Encrypter instance and decrypt the string
 *       Encrypter objEncrypter2 = new Encrypter("A345B2Nu", "DES");
 *       String strDecrypted = objEncrypter2.decrypt(strEncrypted);
 * 
* *

Note: The standard encryption/decryption code examples available on the web * depend on the Base64 encoding/decoding functionality provided by the * sun.misc.Base64Encoder and sun.misc.Base64Decoder classes. These are * unsupported classes; they are also not guaranteed to work on other * platforms. Accordingly, the Encrypter class uses the base64 functionality provided * by the Apache commons-codec class. * * @author David Keener * @version $Id: Encrypter.java,v 1.6 2007/12/31 22:37:00 dkeener Exp $ * * @todo Should add more documentation for the different types of supported encryption * algorithms (the key types). * @todo Should add some validations for the key types provided to the class. */ public class Encrypter { // Default definitions private Cipher m_ecipher = null; private Cipher m_dcipher = null; private String m_keytype = "DES"; private SecretKeySpec m_secretkey = null; /** * Default constructor. The internal Cipher will need to be set * using the setCipher() method before the class instance can * be used for encryption or decryption. */ protected Encrypter() { } // End Method /** * This constructor creates a Encrypter class with all parameters * necessary for the class to be used for encryption and * decryption operations. * * @param sSecretKey The secret key, as a string. * @param sKeyType The type of key. The most common key type * is "DES". */ public Encrypter(String sSecretKey, String sKeyType) { SecretKeySpec secretKey = null; if (sSecretKey != null) { secretKey = generateSecretKey(sSecretKey); setKeyType(sKeyType); setCipher(secretKey); } else { System.out.println("Encrypter: ERROR: Invalid string key provided to constructor."); } } // End Method /** * This constructor creates an Encrypter class with all parameters * necessary for the class to be used for encryption and * decryption operations. * * @param secretKey The secret key, as a SecretKey object, as defined in the * javax.crypto.SecretKey class. * * @param sKeyType The type of key. The most common key type is * "DES". */ public Encrypter(SecretKey secretKey, String sKeyType) { setKeyType(sKeyType); setCipher(secretKey); } // End Method /** * This method stores the key type internally. The most commonly used * encryption type is "DES". * * @param sKeyType The key type, as a string. */ public void setKeyType(String sKeyType) { if (sKeyType != null) { m_keytype = sKeyType; } else { System.out.println("Encrypter.setKeyType: ERROR: Unable to set undefined key type."); } } // End Method /** * This method is used to generate a SecretKey object based on an incoming * secret key string. This key is required in order to perform encryption * and decryption operations. * * @param sSecretKey The secrey key, as a string. * * @return Returns a SecretKey object generated using the secrey key * string parameter and the key type defined in the class. Note that * the key type defaults to "DES" if it has not been previously * set using the setKeyType method. */ public SecretKeySpec generateSecretKey(String sSecretKey) { SecretKeySpec secretKey = null; if (sSecretKey == null) { System.out.println("Encrypter.generateSecretKey: ERROR: Unable to generate secret key for undefined string."); } else if (sSecretKey.length() != 8) { System.out.println("Encrypter.generateSecretKey: ERROR: Secret Key: " + sSecretKey + " is not 8 bytes long."); } else { secretKey = new SecretKeySpec(sSecretKey.getBytes(), m_keytype); } return secretKey; } // End Method /** * This method is used to create the internal Cipher object that will be * used to perform encryption and decryption operations. The method requires * a SecretKey object as a parameter, which can be geberated using the * generateSecretKey method if necessary. * * @param secretKey A SecretKey object. */ public void setCipher(SecretKey secretKey) { if (secretKey == null) { System.out.println("Encrypter.setCipher: ERROR: Unable to set the cipher for an undefined secret key."); } else if (m_keytype == null) { System.out.println("Encrypter.setCipher: ERROR: Unable to set the cipher while key type is undefined."); } else try { m_ecipher = Cipher.getInstance(m_keytype); m_dcipher = Cipher.getInstance(m_keytype); m_ecipher.init(Cipher.ENCRYPT_MODE, secretKey); m_dcipher.init(Cipher.DECRYPT_MODE, secretKey); } catch (NoSuchPaddingException e) { System.out.println("Encrypter.setCipher: ERROR: Unable to set ciphers because " + e); e.printStackTrace(); } catch (NoSuchAlgorithmException e) { System.out.println("Encrypter.setCipher: ERROR: Unable to set ciphers because " + e); e.printStackTrace(); } catch (InvalidKeyException e) { System.out.println("Encrypter.setCipher: ERROR: Unable to set ciphers because " + e); e.printStackTrace(); } } // End Method /** * This method encrypts a string using an internal Cipher created either by an * appropriate constructor or by previously calling the setCipher method. * * @param sString The string to be encrypted. * * @return Returns the encrypted string. */ public String encrypt(String sString) { String sEncrypted = null; if (sString == null) { System.out.println("Encrypter.Encrypt: ERROR: Unable to encrypt undefined string"); } else if (m_ecipher == null) { System.out.println("Encrypter.Encrypt: ERROR: Unable to encrypt string: " + sString + " while encryption cypher is not defined."); } else try { byte[] bUtf8 = null; byte[] bEnc = null; // Encode the string into bytes using utf-8 bUtf8 = sString.getBytes("UTF8"); // Encrypt bEnc = m_ecipher.doFinal(bUtf8); // Encode bytes to base64 to get a string sEncrypted = new String(Base64.encodeBase64(bEnc)); // sEncrypted = new BASE64Encoder().encode(bEnc); -- Replaced the Sun version } catch (Exception e) { System.out.println("Encrypter.Encrypt: ERROR: Unable to encrypt string: " + sString + " because " + e); e.printStackTrace(); } return sEncrypted; } // End Method /** * This method decrypts a string using an internal Cipher created either by an * appropriate constructor or by previously calling the setCipher method. * * @param sString The string to be decrypted. * * @return Returns the decrypted string. */ public String decrypt(String sString) { String sDecrypted = null; byte[] bDec = null; if (sString == null) { System.out.println("Encrypter.Decrypt: ERROR: Unable to decrypt undefined string"); } else if (m_dcipher == null) { System.out.println("Encrypter.Decrypt: ERROR: Unable to decrypt string: " + sString + " while decryption cypher is not defined."); } else try { byte[] bUtf8 = null; // Decode base64 to get bytes bDec = Base64.decodeBase64(sString.getBytes("UTF8")); // bDec = new BASE64Decoder().decodeBuffer(sString); -- Replaced Sun version // Decrypt bUtf8 = m_dcipher.doFinal(bDec); // Decode using utf-8 sDecrypted = new String(bUtf8, "UTF8"); } catch (BadPaddingException e) { System.out.println("Encrypter.Decrypt: ERROR: Unable to decrypt string: (" + sString.length() + ") " + sString + " byte Decoder: " + bDec + " because " + e); e.printStackTrace(); } catch (IllegalBlockSizeException e) { System.out.println("Encrypter.Decrypt: ERROR: Unable to decrypt string: (" + sString.length() + ") " + sString + " byte Decoder: " + bDec + " because " + e); e.printStackTrace(); } catch (UnsupportedEncodingException e) { System.out.println("Encrypter.Decrypt: ERROR: Unable to decrypt string: (" + sString.length() + ") " + sString + " byte Decoder: " + bDec + " because " + e); e.printStackTrace(); } catch (IOException e) { System.out.println("Encrypter.Decrypt: ERROR: Unable to decrypt string: (" + sString.length() + ") " + sString + " byte Decoder: " + bDec + " because " + e); e.printStackTrace(); } return sDecrypted; } // End Method /** * This main() method can be used to encrypt or decrypt a string using an optional * key string provided by the user. If no key is provided, then the default key will * be used. If provided, the key string should be 8 bytes long. Since this main * program is primarily for demonstration purposes, it uses the DES encryption * mechanism, which is useful but certainly not the strongest encryption possible. * *

To execute the main program, first make sure that the Antimatter jar is in the * CLASSPATH. Then, execute the main method from the jar file as shown below: * *

   java com.keenertech.antimatter.Encrypter [arguments] * *

The main program expects one of the following sets of arguments: * *