com.plumtree.openfoundation.security
Class XPRC2Crypto

java.lang.Object
  extended by com.plumtree.openfoundation.security.XPRC2Crypto
All Implemented Interfaces:
IXPCrypto

public class XPRC2Crypto
extends java.lang.Object
implements IXPCrypto

XPRC2Crypto encrypts text using RC2-40 with a maximum password length of 128 characters, and decrypts text encrypted with this method or with an older Plumtree legacy cipher. This class is compatible with PTCipherUtility. Does not currently support generation or use of byte[] keys.


Field Summary
static char RC2_ENCRYPTION_MARKER_40
          40-bit RC2 encryption marker.
 
Constructor Summary
XPRC2Crypto()
          Creates a new XPCrypto object.
 
Method Summary
 boolean CanDecrypt(java.lang.String toDecrypt)
          True if recognized as a possible ciphertext compatible with this cryptographic engine.
 java.lang.String Decrypt(java.lang.String toDecrypt, byte[] key)
          Not implemented in this version, use the Encrypt/Decrypt methods taking a String key.
 java.lang.String Decrypt(java.lang.String strToDecrypt, java.lang.String strKey)
          Decrypts the string with the key.
 java.lang.String Encrypt(java.lang.String toEncrypt, byte[] key)
          Not implemented in this version, use the Encrypt/Decrypt methods taking a String key.
 java.lang.String Encrypt(java.lang.String strToEncrypt, java.lang.String strKey)
          Encrypts a string, based on the key.
 byte[] GenerateKey()
          Not implemented in this version, use the Encrypt/Decrypt methods taking a String key.
static void main(java.lang.String[] args)
          Tests basic encryption and decryption functionality.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RC2_ENCRYPTION_MARKER_40

public static final char RC2_ENCRYPTION_MARKER_40
40-bit RC2 encryption marker.

See Also:
Constant Field Values
Constructor Detail

XPRC2Crypto

public XPRC2Crypto()
Creates a new XPCrypto object.

Method Detail

Encrypt

public java.lang.String Encrypt(java.lang.String strToEncrypt,
                                java.lang.String strKey)
Encrypts a string, based on the key.

Specified by:
Encrypt in interface IXPCrypto
Parameters:
strToEncrypt - the string to be encrypted
strKey - the encryption key
Returns:
the encrypted string

Decrypt

public java.lang.String Decrypt(java.lang.String strToDecrypt,
                                java.lang.String strKey)
Decrypts the string with the key.

Specified by:
Decrypt in interface IXPCrypto
Parameters:
strToDecrypt - string to be decrypted
strKey - key, need to match the encryption key
Returns:
the decrypted string

main

public static void main(java.lang.String[] args)
Tests basic encryption and decryption functionality.

Parameters:
args - input arguments passed to main method.

CanDecrypt

public boolean CanDecrypt(java.lang.String toDecrypt)
True if recognized as a possible ciphertext compatible with this cryptographic engine. True when the ciphertext argument begins with a marker character indicating Plumtree RC2-40bit encryption or a hex digit 0-9A-F for Plumtree's legacy cipher.

Specified by:
CanDecrypt in interface IXPCrypto
Parameters:
toDecrypt - an encrypted string
Returns:
true if this provider can decrypt the string

Decrypt

public java.lang.String Decrypt(java.lang.String toDecrypt,
                                byte[] key)
Not implemented in this version, use the Encrypt/Decrypt methods taking a String key.

Specified by:
Decrypt in interface IXPCrypto
Parameters:
toDecrypt - the data to decrypt
key - the key to use to decrypt the data
Returns:
the decrypted data

Encrypt

public java.lang.String Encrypt(java.lang.String toEncrypt,
                                byte[] key)
Not implemented in this version, use the Encrypt/Decrypt methods taking a String key.

Specified by:
Encrypt in interface IXPCrypto
Parameters:
toEncrypt - the data to encrypt
key - the key to use to encrypt the data
Returns:
the encrypted data

GenerateKey

public byte[] GenerateKey()
Not implemented in this version, use the Encrypt/Decrypt methods taking a String key.

Specified by:
GenerateKey in interface IXPCrypto
Returns:
This is not implemented yet.


Copyright © 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.