|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.plumtree.openfoundation.security.XPAESCrypto
public class XPAESCrypto
XPAESCrypto implements AES 128-bit encryption for String values. For encryption, plaintext strings are converted to their UTF-8 byte representation first. These bytes are encrypted and then base64-encoded back into a String. Finally, an encryption marker is prepended to indicate the type of encryption used.
Field Summary | |
---|---|
static int |
AES_BLOCK_SIZE
Block size in bytes for both 256-bit and 128-bit AES encryption. |
static char |
AES_ENCRYPTION_MARKER_128
Encryption marker for Open Kernel 128-bit encrypted strings. |
static int |
MAX_KEY_SIZE_128
Maximum number of bytes for a 128-bit AES key. |
Constructor Summary | |
---|---|
XPAESCrypto(XPCryptoType cryptoType)
Creates a new XPAESCrypto object. |
Method Summary | |
---|---|
boolean |
CanDecrypt(java.lang.String toDecrypt)
Can this provider decrypt this string? |
java.lang.String |
Decrypt(java.lang.String cipherText,
byte[] key)
Decrypts data which was encrypted using |
java.lang.String |
Decrypt(java.lang.String cipherText,
java.lang.String password)
Decrypts data which was encrypted using |
java.lang.String |
Encrypt(java.lang.String plainText,
byte[] key)
Encrypts data. |
java.lang.String |
Encrypt(java.lang.String plainText,
java.lang.String password)
Encrypts data. |
byte[] |
GenerateKey()
Generate a key with default scenario, by allocating an array of the desired key size and add the size of the AES block and filling it with random bytes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char AES_ENCRYPTION_MARKER_128
public static final int MAX_KEY_SIZE_128
public static final int AES_BLOCK_SIZE
Constructor Detail |
---|
public XPAESCrypto(XPCryptoType cryptoType)
cryptoType
- The CryptoType must be XPCryptoType.AES_128.Method Detail |
---|
public java.lang.String Encrypt(java.lang.String plainText, java.lang.String password)
IXPCrypto
Encrypt
in interface IXPCrypto
plainText
- the data to encryptpassword
- a key generated from this password will be used to decrypt the data
public java.lang.String Encrypt(java.lang.String plainText, byte[] key)
IXPCrypto
Encrypt
in interface IXPCrypto
plainText
- the data to encryptkey
- the key to use to encrypt the data
public java.lang.String Decrypt(java.lang.String cipherText, java.lang.String password)
IXPCrypto
Decrypt
in interface IXPCrypto
cipherText
- the data to decryptpassword
- a key generated from this password will be used to decrypt the data
public java.lang.String Decrypt(java.lang.String cipherText, byte[] key)
IXPCrypto
Decrypt
in interface IXPCrypto
cipherText
- the data to decryptkey
- the key to use to decrypt the data
public boolean CanDecrypt(java.lang.String toDecrypt)
IXPCrypto
CanDecrypt
in interface IXPCrypto
toDecrypt
- an encrypted string
public byte[] GenerateKey()
GenerateKey
in interface IXPCrypto
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |