home

Text Encrypter Update

After a year I've decided to update my text encrypter! Yep, it's been a year already, time flies.

What's new?

I've rewritten the encryption bit to be much more secure! The key is now 'salted' and hashed before being used to encrypt the text. A random initial vector is also created for the base of the encryption. The random salt and vector are placed in the output along with the encrypted text. In the future the salt could be placed along with the program but it would mean that it could only be decrypted by one machine. (installation of the program)

On a side note, the length of the key is 128 bits as you would need to download an update to remove the limitation on the key size in Java. (And be able to encrypt using 192 or 256 bits keys.) I've finally fixed a few small bugs concerning saving new files and accessing other drives. No other major changes in the GUI or the behaviour of the software.

Your old files will not be compatible with the new version! You will need to decrypt them with the 0.1 and re-encrypt them with the new 0.2 version.

Download

Here is the new zip file: TextEncrypter.0.2.zip

Text Encrypter

Here is what I've been developing the last few weeks:
Text Encrypter is a free tool that allows you to create and encode text. The purpose is to be able to protect sensitive data as passwords or over profile information. Feel free to protect any data you want.

The encryption uses the AES algorithm and the key is encoded in Sha-1 before being used.

Download

This program is at an early stage and may not be stable, but you can still download it here: TextEncrypter.0.1.zip

About

This program has been developed in Java and uses the icons available at famfamfam.com . To run it you must have version 1.6 of Java or higher.

Some of the code

While developing this app I made some interesting classes you may want to use in your own projects. One of them is a custom TextField class that allows me to have a placeholder. Simple and small, there it is:
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.RenderingHints;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.Graphics2D;
 
import javax.swing.JTextField;
 
public class JTextFieldPlaceHolder extends JTextField{
    private String placeHolder;
     
    private Color textColor = Color.BLACK;
    private Color placeHolderColor = Color.GRAY;
     
    JTextFieldPlaceHolder(){
        this("", "");
    }
     
    JTextFieldPlaceHolder(String placeHolderInit){
        this(placeHolderInit, "");
    }
     
    JTextFieldPlaceHolder(String placeHolderInit, String value){
        super(value);
         
        this.setMargin(new Insets(0,5,0,5));            // We set the margin so the text doesn't stick to the textField
        this.setMinimumSize(new Dimension(70, 35));     // We set a minimum size so that the textField doesn't end up crushed in small containers
         
        placeHolder = placeHolderInit;                  // We set the placeHolder variable
         
        this.setForeground(textColor);                  // We finally set the color of the text
    }
     
    // We override the paint method to draw the placeHolder when needed
    public void paint(Graphics g)
    {
        super.paint(g);
         
        // if the textField is empty
        if(this.getText().equals("")){
            Graphics2D g2d = (Graphics2D)g;             // Cast g into Graphics2D to be able to draw smooth text
            g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON );
            g2d.setFont(this.getFont());                // Set the font into the textField font
            g2d.setColor(placeHolderColor);             // Set the font color, then draw the text
            g2d.drawString(placeHolder, 7, (this.getHeight()/2)+(this.getFont().getSize()/2)-1);
        }
    }
     
    public String getPlaceHolder(){
        return this.placeHolder;
    }
     
    public void setPlaceHolder(String newPlaceHolder){
        this.placeHolder = newPlaceHolder;
    }
     
    public Color getPlaceHolderColor(){
        return this.placeHolderColor;
    }
     
    public void setPlaceHolderColor(Color newPlaceHolderColor){
        this.placeHolderColor = newPlaceHolderColor;
    }
}
Here’s an example:
JTextField myinput = new JTextFieldPlaceHolder("PlaceHolder","InitialValue");
JTextField myinput2 = new JTextFieldPlaceHolder("PlaceHolder");
JTextField myinput3 = new JTextFieldPlaceHolder();
More source code will be available soon.
1