@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()
PlexusCiphernull.availableCiphers in interface PlexusCipherpublic String encrypt(String alg, String str, String passPhrase) throws PlexusCipherException
PlexusCipherencrypt in interface PlexusCipheralg - cipher alg to use, never nullstr - string to encrypt, never nullpassPhrase - pass phrase, never nullnullPlexusCipherException - if encryption failspublic String encryptAndDecorate(String alg, String str, String passPhrase) throws PlexusCipherException
PlexusCipherencryptAndDecorate in interface PlexusCipheralg - cipher alg to use, never nullstr - string to encrypt, never nullpassPhrase - pass phrase, never nullnullPlexusCipherException - if encryption failspublic String decrypt(String alg, String str, String passPhrase) throws PlexusCipherException
PlexusCipherdecrypt in interface PlexusCipheralg - cipher alg to use, never nullstr - string to encrypt, never nullpassPhrase - pass phrase, never nullnullPlexusCipherException - if encryption failspublic String decryptDecorated(String alg, String str, String passPhrase) throws PlexusCipherException
PlexusCipherdecryptDecorated in interface PlexusCipheralg - cipher alg to use, never nullstr - string to encrypt, never nullpassPhrase - pass phrase, never nullnullPlexusCipherException - if encryption failspublic boolean isEncryptedString(String str)
PlexusCipherisEncryptedString in interface PlexusCipherpublic String unDecorate(String str) throws PlexusCipherException
PlexusCipherunDecorate in interface PlexusCipherPlexusCipherException - is string is malformedpublic String decorate(String str)
PlexusCipherdecorate in interface PlexusCipherpublic static String[] getServiceTypes()
public static String[] getCryptoImpls(String serviceType)
public static void main(String[] args)
Copyright © 2001–2024 Codehaus Plexus. All rights reserved.