tribble.crypto
Class Encoder

java.lang.Object
  extended bytribble.crypto.Encoder

public final class Encoder
extends java.lang.Object

Methods for encoding (encrypting) user data.

Since:
2002-03-21
Version:
$Revision: 1.1 $ $Date: 2002/03/22 03:46:31 $
Author:
David R. Tribble (david@tribble.com).
Copyright ©2002 by David R. Tribble, all rights reserved.
Permission is granted to freely use and distribute this source code provided that the original copyright and authorship notices remain intact.
See Also:
Decoder

Method Summary
static java.lang.String encode(java.lang.String s, java.lang.String key)
          Encrypt a given string using a given password.
static void main(java.lang.String[] args)
          Test driver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Test driver.

Usage

    java tribble.crypto.Encoder plaintext password
 

Parameters:
args - Command line arguments.
Throws:
java.lang.Exception
Since:
1.1, 2002-03-21

encode

public static java.lang.String encode(java.lang.String s,
                                      java.lang.String key)
                               throws java.security.GeneralSecurityException
Encrypt a given string using a given password.

Parameters:
s - A string to encrypt.
key - An encryption password. This is converted into a binary encryption key of the appropriate length.
Returns:
The string s suitably encrypted. Random salt data is added to the encrypted data in order to allow for verification when the data is decrypted, and to make cracking the encryption much more difficult.
Throws:
java.security.GeneralSecurityException - Thrown if an error occurs.
Since:
1.1, 2002-03-21
See Also:
Decoder.decode(String, String)