tribble.crypto
Class Decoder

java.lang.Object
  extended bytribble.crypto.Decoder

public final class Decoder
extends java.lang.Object

Methods for decoding (decrypting) user data.

Since:
2002-03-21
Version:
$Revision: 1.1 $ $Date: 2002/03/22 03:47:43 $
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:
Encoder

Method Summary
static java.lang.String decode(java.lang.String s, java.lang.String key)
          Decrypt a given encrypted 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.Decoder ciphertext password
 

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

decode

public static java.lang.String decode(java.lang.String s,
                                      java.lang.String key)
                               throws java.security.GeneralSecurityException
Decrypt a given encrypted string using a given password.

Parameters:
s - A string to decrypt.
key - An decryption password. This is converted into a binary decryption key of the appropriate length.
Returns:
The string s suitably decrypted, with any trailing padding bytes removed.
Throws:
java.security.GeneralSecurityException - Thrown if the decryption fails, which is detected if the salt used to encrypt the password does not match its decrypted value, or if some other error occurs.
Since:
1.1, 2002-03-21
See Also:
Encoder.encode(String, String)