|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.metamatrix.common.util.crypto.CryptoUtil
public class CryptoUtil
Collection of Crypto utilities and helpers for use by the server and installers.
Field Summary | |
---|---|
static java.lang.String |
ENCRYPT_PREFIX
|
static java.lang.String |
ENCRYPTION_ENABLED
This property indicates the encryption provider, if set to none encryption is disabled. |
static java.net.URL |
KEY
|
static java.lang.String |
KEY_NAME
The name of the key. |
static java.lang.String |
NONE
|
static java.lang.String |
OLD_ENCRYPT_PREFIX
|
Constructor Summary | |
---|---|
CryptoUtil()
|
Method Summary | |
---|---|
static boolean |
canDecrypt(java.lang.String cipherText)
|
static Cryptor |
getCryptor()
Construct and return a utility that can be used for either encryption or decryption. |
static Decryptor |
getDecryptor()
Construct and return a utility that can be used for only decryption. |
static Encryptor |
getEncryptor()
Construct and return a utility that can be used for only encryption. |
static void |
init(java.net.URL keyResource)
Initialize this factory, bound to the given keystore and keystore password. |
static boolean |
isEncryptionEnabled()
|
static boolean |
isInitialized()
|
static boolean |
isValueEncrypted(java.lang.String value)
|
static void |
main(java.lang.String[] args)
|
static java.util.Properties |
propertyDecrypt(java.lang.String match,
java.util.Properties props)
Decrypts given set of property values based on occurrence of the property name in the match collection. |
static java.util.Properties |
propertyDecryptEndsWith(java.lang.String pattern,
java.util.Properties props)
Decrypts given set of property values based on occurance of the property name ending in with the given pattern. |
static java.util.Properties |
propertyEncrypt(java.lang.String match,
java.util.Properties props)
Encrypts given set of property values based on occurrence of the property name in the match collection. |
static java.util.Properties |
propertyEncryptEndsWith(Encryptor encryptor,
java.lang.String pattern,
java.util.Properties props)
Encrypts given set of property values based on occurance of the property name ending in with the given pattern, using the specified encryptor. |
static java.util.Properties |
propertyEncryptEndsWith(java.lang.String pattern,
java.util.Properties props)
Encrypts given set of property values based on occurrence of the property name ending in with the given pattern, using the server-side encryptor. |
static void |
reinit()
Allows tests to reinit if necessary |
static java.lang.String |
stringDecrypt(java.lang.String cipherText)
|
static java.lang.String |
stringEncrypt(java.lang.String clearText)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ENCRYPTION_ENABLED
public static final java.lang.String KEY_NAME
public static final java.net.URL KEY
public static final java.lang.String OLD_ENCRYPT_PREFIX
public static final java.lang.String ENCRYPT_PREFIX
public static final java.lang.String NONE
Constructor Detail |
---|
public CryptoUtil()
Method Detail |
---|
public static boolean isEncryptionEnabled()
public static java.util.Properties propertyEncrypt(java.lang.String match, java.util.Properties props) throws CryptoException
match
collection.
match
- A Set of property names that, if found in props
property names, will modify the associated value in props
.
Note: This is a case insensitive match.props
- The properties whose values are to be modified in place.
CryptoException
- if there's an error with the Cryptor
.public static java.util.Properties propertyDecrypt(java.lang.String match, java.util.Properties props) throws CryptoException
match
collection.
match
- A Set of property names that, if found in props
property names, will modify the associated value in props
.
Note: This is a case insensitive match.props
- The properties whose values are to be modified in place.
CryptoException
- if there's an error with the Cryptor
.public static java.util.Properties propertyEncryptEndsWith(java.lang.String pattern, java.util.Properties props) throws CryptoException
pattern
- A pattern that, if found at the end of a props
property name, will modify the associated value in props
.
Note: This is a case insensitive match.props
- The properties whose values are to be modified.
CryptoException
- if there's an error with the Cryptor
.public static java.util.Properties propertyEncryptEndsWith(Encryptor encryptor, java.lang.String pattern, java.util.Properties props) throws CryptoException
encryptor
- Encryptor to use.pattern
- A pattern that, if found at the end of a props
property name, will modify the associated value in props
.
Note: This is a case insensitive match.props
- The properties whose values are to be modified.
CryptoException
- if there's an error with the Cryptor
.public static java.util.Properties propertyDecryptEndsWith(java.lang.String pattern, java.util.Properties props) throws CryptoException
pattern
- A pattern that, if found at the end of a props
property name, will modify the associated value in props
.
Note: This is a case insensitive match.props
- The properties whose values are to be modified.
CryptoException
- if there's an error with the Cryptor
.public static boolean isValueEncrypted(java.lang.String value)
public static void init(java.net.URL keyResource) throws CryptoException
Initialize this factory, bound to the given keystore and keystore password.
This method will initialize the cryptor with the given
keystore and will not use the application classpath to find
the keystore to use.
The key entry name is well-known.
storeFilename
- url to the keystore file.storePass
- The password used to unlock the keystore.
CryptoException
public static Cryptor getCryptor() throws CryptoException
Cryptor
interface
CryptoException
- If there was a problem getting the keys
required to initialize the cipher, or if there was a
problem initializing the cipher utilitypublic static Encryptor getEncryptor() throws CryptoException
Encryptor
interface
CryptoException
- If there was a problem getting the key
required to initialize the cipher, or if there was a
problem initializing the cipher utilitypublic static Decryptor getDecryptor() throws CryptoException
Decryptor
interface
CryptoException
- If there was a problem getting the key
required to initialize the cipher, or if there was a
problem initializing the cipher utilitypublic static java.lang.String stringEncrypt(java.lang.String clearText) throws CryptoException
CryptoException
public static java.lang.String stringDecrypt(java.lang.String cipherText) throws CryptoException
CryptoException
public static boolean canDecrypt(java.lang.String cipherText)
public static void reinit()
public static boolean isInitialized()
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |