|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.sdsc.inca.util.Crypter
public class Crypter
The Crypter class provides the ability to de/encrypt strings.
Field Summary | |
---|---|
protected javax.crypto.Cipher |
decipher
|
protected javax.crypto.Cipher |
encipher
|
Constructor Summary | |
---|---|
Crypter(java.lang.String passphrase,
java.lang.String algorithm)
Constructs a Crypter that can de/encrypt strings using a specified passphrase and algorithm. |
Method Summary | |
---|---|
protected java.lang.String |
cryptMatchingSubstrings(java.lang.String s,
java.util.regex.Pattern p,
boolean decrypt)
Returns a specified string with all substrings that match a specified pattern de/encrypted. |
java.lang.String |
decrypt(java.lang.String s)
Returns the decrypted version of a specified string. |
java.lang.String |
decryptMatchingSubstrings(java.lang.String s,
java.util.regex.Pattern p)
Returns a specified string with all substrings that match a specified pattern decrypted. |
java.lang.String |
decryptMatchingSubstrings(java.lang.String s,
java.lang.String p)
Returns a specified string with all substrings that match a specified pattern decrypted. |
java.lang.String |
encrypt(java.lang.String s)
Returns the encrypted version of a specified string. |
java.lang.String |
encryptMatchingSubstrings(java.lang.String s,
java.util.regex.Pattern p)
Returns a specified string with all substrings that match a specified pattern encrypted. |
java.lang.String |
encryptMatchingSubstrings(java.lang.String s,
java.lang.String p)
Returns a specified string with all substrings that match a specified pattern encrypted. |
javax.crypto.Cipher |
getDecipher()
Return a cipher that can be used for decryption. |
javax.crypto.Cipher |
getEncipher()
Return a cipher that can be used for encryption. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected javax.crypto.Cipher decipher
protected javax.crypto.Cipher encipher
Constructor Detail |
---|
public Crypter(java.lang.String passphrase, java.lang.String algorithm) throws CrypterException
passphrase
- the de/encryption passphrasealgorithm
- the de/encryption algorithm, e.g., DES
CrypterException
- if initialization of the ciphers failMethod Detail |
---|
public java.lang.String decrypt(java.lang.String s) throws CrypterException
s
- the string to decrypt
CrypterException
- on errorpublic java.lang.String decryptMatchingSubstrings(java.lang.String s, java.util.regex.Pattern p) throws CrypterException
s
- the string to decryptp
- the pattern to search for and decrypt in the string
CrypterException
- on errorpublic java.lang.String decryptMatchingSubstrings(java.lang.String s, java.lang.String p) throws CrypterException, java.util.regex.PatternSyntaxException
s
- the string to decryptp
- the pattern to search for and decrypt in the string
CrypterException
- on error
java.util.regex.PatternSyntaxException
- if the pattern is faultypublic java.lang.String encrypt(java.lang.String s) throws CrypterException
s
- the string to encrypt
CrypterException
- on errorpublic java.lang.String encryptMatchingSubstrings(java.lang.String s, java.util.regex.Pattern p) throws CrypterException
s
- the string to encryptp
- the pattern to search for and encrypt in the string
CrypterException
public java.lang.String encryptMatchingSubstrings(java.lang.String s, java.lang.String p) throws CrypterException, java.util.regex.PatternSyntaxException
s
- the string to encryptp
- the pattern to search for and encrypt in the string
CrypterException
- on error
java.util.regex.PatternSyntaxException
- if the pattern is faultypublic javax.crypto.Cipher getDecipher()
public javax.crypto.Cipher getEncipher()
protected java.lang.String cryptMatchingSubstrings(java.lang.String s, java.util.regex.Pattern p, boolean decrypt) throws CrypterException
s
- the string to encryptp
- the pattern to search for and de/encrypt in the stringdecrypt
- whether the method should decrypt or decrypt
CrypterException
- on error
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |