com.plumtree.openfoundation.security
Class XPCrypto

java.lang.Object
  extended bycom.plumtree.openfoundation.security.XPCrypto

public class XPCrypto
extends java.lang.Object

Main class used for cryptography operations.

Can be used to get a crypto instance to encrypt a string, i.e.:

XPCrypto.GetInstance(XPCryptoType.RC2).Encrypt();

Can be used to decrypt a string directly, i.e.(this will attempt to determine type of crypto used to encrypt):

XPCrypto.Decrypt(myciphertext,"mykey")


Method Summary
static java.lang.String Decrypt(java.lang.String toDecrypt, java.lang.String key)
          Decrypts data.
static IXPCrypto GetInstance(XPCryptoType type)
          Gets an IXPCrypto instance which can be use to encrypt and decrypt data using private key encryption.
static IXPPKICrypto GetPKIInstance(XPPKICryptoType type)
          Gets an IXPPKICrypto instance which can be use to encrypt, decrypt, sign and verify data using public key encryption.
static boolean UsesPKIEncrytion(java.lang.String toDecrypt)
          Determines whether a string has been encrypted using PKI encryption.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

GetInstance

public static IXPCrypto GetInstance(XPCryptoType type)
Gets an IXPCrypto instance which can be use to encrypt and decrypt data using private key encryption.

Parameters:
type - the type of crypto instance required
Returns:
an IXPCrypto instance

GetPKIInstance

public static IXPPKICrypto GetPKIInstance(XPPKICryptoType type)
Gets an IXPPKICrypto instance which can be use to encrypt, decrypt, sign and verify data using public key encryption.

Parameters:
type - the type of crypto instance required
Returns:
an IXPPKICrypto instance

Decrypt

public static java.lang.String Decrypt(java.lang.String toDecrypt,
                                       java.lang.String key)
Decrypts data. This attempts to locate the crypto instance used to encrypt the data and uses it to decrypt it. Encryption must be performed using an instance obtained using GetInstance(XPCryptoType)

Parameters:
toDecrypt - the data to decrypt
key - the key to use to decrypt the data
Returns:
the decrypted data
Throws:
XPIllegalArgumentException - if the key or ciphertext to decrypt is null or empty.
XPCryptoException - if the encrypted string appears to be encrypted with a PKI cipher.
XPNoSuchAlgorithmException - (subtype of XPCryptoException) if the encryption method is not recognized.

UsesPKIEncrytion

public static boolean UsesPKIEncrytion(java.lang.String toDecrypt)
Determines whether a string has been encrypted using PKI encryption.

Parameters:
toDecrypt - the string which has been encryted
Returns:
true if and only if this string was encrypted using PKI encryption


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