Class Crypto
java.lang.Object
edu.internet2.middleware.grouperClientExt.edu.internet2.middleware.morphString.Crypto
Deprecated.
use edu.internet2.middleware.morphString.Crypto instead!
The purpose of this class is to provide encryption
and decryption using standard Java libraries, for potentially
large amounts of data.
This class provides default encryption using AES with a constant 128 bit key. If you want something more secure feel free to override the defaults however you please.
This class works in one of two ways, (1) in memory using Strings, or (2) via I/O streams (preferred for large amounts of data).
Crypo objects, or more specifically the default ciphers they create, are not threadsafe and are not computationally cheap, so a threadlocal factory method is provided for convenience. This is the preferred means of usage, but feel free to create these objects however you please.
Note that you can encrypt BLOB fields by specifying encryption in the configurator (Crypto is the default encryption mechanism for that).
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Create the default cipherdecrypt
(InputStream in) Deprecated.the decrypted input streamdecrypt
(OutputStream out) Deprecated.the decrypted output streamDeprecated.Decrypt the stringencrypt
(InputStream in) Deprecated.Get the encrypted input streamencrypt
(OutputStream out) Deprecated.the encrypted output streamDeprecated.Encrypt the stringstatic byte[]
generateKeyBytes
(String cipherName, Integer keybits) Deprecated.Generate a key.static Crypto
Deprecated.
-
Constructor Details
-
Crypto
Deprecated. -
Crypto
public Crypto()Deprecated.Default crypto object -
Crypto
Deprecated.Default crypto object- Parameters:
theKey
- used to encrypt/decrypt
-
-
Method Details
-
getThreadLocalCrypto
Deprecated.- Returns:
- a non-null thread-safe crypto object from a ThreadLocal
-
generateKeyBytes
Deprecated.Generate a key.- Parameters:
cipherName
- the name of the cipher, if null will default to "AES"keybits
- the number of bits in the key, if null will default to 128- Returns:
- the bytes comprising the key
-
createDefaultCipher
Deprecated.Create the default cipher- Returns:
- the default cipher
-
encrypt
Deprecated.Encrypt the string- Parameters:
clearText
-- Returns:
- the encrypted String
-
decrypt
Deprecated.Decrypt the string- Parameters:
cipherText
-- Returns:
- the decrypted string
-
encrypt
Deprecated.Get the encrypted input stream- Parameters:
in
-- Returns:
- the encrypted input stream
-
decrypt
Deprecated.the decrypted input stream- Parameters:
in
-- Returns:
- the decrypted input stream
-
encrypt
Deprecated.the encrypted output stream- Parameters:
out
-- Returns:
- the encrypted output stream
-
decrypt
Deprecated.the decrypted output stream- Parameters:
out
-- Returns:
- the decrypted output stream
-