@Singleton @Named public class DefaultPlexusCipher extends Object implements PlexusCipher
PlexusCipher
. This class is thread safe.Constructor and Description |
---|
DefaultPlexusCipher(Map<String,Cipher> ciphers) |
Modifier and Type | Method and Description |
---|---|
Set<String> |
availableCiphers()
Returns the available cipher algorithms, never
null . |
String |
decorate(String str)
Decorates given string.
|
String |
decrypt(String alg,
String str,
String passPhrase)
Decrypt given Base64 encoded string with the given alg and passPhrase and return resulting string.
|
String |
decryptDecorated(String alg,
String str,
String passPhrase)
Decrypt given decorated Base64 encoded string with the given alg and passPhrase and return resulting string.
|
String |
encrypt(String alg,
String str,
String passPhrase)
Encrypt given string with the given alg and passPhrase and encode it into Base64 string.
|
String |
encryptAndDecorate(String alg,
String str,
String passPhrase)
Encrypt given string with the given alg and passPhrase and encode it into Base64 decorated string.
|
static String[] |
getCryptoImpls(String serviceType)
This method returns the available implementations for a service type
|
static String[] |
getServiceTypes()
Exploratory part.
|
boolean |
isEncryptedString(String str)
Check if given string is decorated.
|
static void |
main(String[] args) |
String |
unDecorate(String str)
Remove decorations from string, if it was decorated.
|
public Set<String> availableCiphers()
PlexusCipher
null
.availableCiphers
in interface PlexusCipher
public String encrypt(String alg, String str, String passPhrase) throws PlexusCipherException
PlexusCipher
encrypt
in interface PlexusCipher
alg
- cipher alg to use, never null
str
- string to encrypt, never null
passPhrase
- pass phrase, never null
null
PlexusCipherException
- if encryption failspublic String encryptAndDecorate(String alg, String str, String passPhrase) throws PlexusCipherException
PlexusCipher
encryptAndDecorate
in interface PlexusCipher
alg
- cipher alg to use, never null
str
- string to encrypt, never null
passPhrase
- pass phrase, never null
null
PlexusCipherException
- if encryption failspublic String decrypt(String alg, String str, String passPhrase) throws PlexusCipherException
PlexusCipher
decrypt
in interface PlexusCipher
alg
- cipher alg to use, never null
str
- string to encrypt, never null
passPhrase
- pass phrase, never null
null
PlexusCipherException
- if encryption failspublic String decryptDecorated(String alg, String str, String passPhrase) throws PlexusCipherException
PlexusCipher
decryptDecorated
in interface PlexusCipher
alg
- cipher alg to use, never null
str
- string to encrypt, never null
passPhrase
- pass phrase, never null
null
PlexusCipherException
- if encryption failspublic boolean isEncryptedString(String str)
PlexusCipher
isEncryptedString
in interface PlexusCipher
public String unDecorate(String str) throws PlexusCipherException
PlexusCipher
unDecorate
in interface PlexusCipher
PlexusCipherException
- is string is malformedpublic String decorate(String str)
PlexusCipher
decorate
in interface PlexusCipher
public static String[] getServiceTypes()
public static String[] getCryptoImpls(String serviceType)
public static void main(String[] args)
Copyright © 2001–2024 Codehaus Plexus. All rights reserved.