Class DefaultPlexusCipher
- java.lang.Object
-
- org.sonatype.plexus.components.cipher.DefaultPlexusCipher
-
- All Implemented Interfaces:
PlexusCipher
@Named("default") @Typed(PlexusCipher.class) public class DefaultPlexusCipher extends Object implements PlexusCipher
- Author:
- Oleg Gusakov
-
-
Field Summary
-
Fields inherited from interface org.sonatype.plexus.components.cipher.PlexusCipher
ENCRYPTED_STRING_DECORATION_START, ENCRYPTED_STRING_DECORATION_STOP
-
-
Constructor Summary
Constructors Constructor Description DefaultPlexusCipher()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
decorate(String str)
decorated given string with { and }String
decrypt(String str, String passPhrase)
decrypt given base64 encrypted stringString
decryptDecorated(String str, String passPhrase)
decrypt given base64 encoded encrypted string.String
encrypt(String str, String passPhrase)
encrypt given string with the given passPhrase and encode it into base64String
encryptAndDecorate(String str, String passPhrase)
encrypt given string with the given passPhrase, encode it into base64 and return result, wrapped into { } decorationsstatic String[]
getCryptoImpls(String serviceType)
This method returns the available implementations for a service typestatic String[]
getServiceTypes()
Exploratory part.boolean
isEncryptedString(String str)
check if given string is decoratedstatic void
main(String[] args)
String
unDecorate(String str)
return string inside decorations
-
-
-
Constructor Detail
-
DefaultPlexusCipher
public DefaultPlexusCipher() throws PlexusCipherException
- Throws:
PlexusCipherException
-
-
Method Detail
-
encrypt
public String encrypt(String str, String passPhrase) throws PlexusCipherException
Description copied from interface:PlexusCipher
encrypt given string with the given passPhrase and encode it into base64- Specified by:
encrypt
in interfacePlexusCipher
- Returns:
- Throws:
PlexusCipherException
-
encryptAndDecorate
public String encryptAndDecorate(String str, String passPhrase) throws PlexusCipherException
Description copied from interface:PlexusCipher
encrypt given string with the given passPhrase, encode it into base64 and return result, wrapped into { } decorations- Specified by:
encryptAndDecorate
in interfacePlexusCipher
- Returns:
- Throws:
PlexusCipherException
-
decrypt
public String decrypt(String str, String passPhrase) throws PlexusCipherException
Description copied from interface:PlexusCipher
decrypt given base64 encrypted string- Specified by:
decrypt
in interfacePlexusCipher
- Returns:
- Throws:
PlexusCipherException
-
decryptDecorated
public String decryptDecorated(String str, String passPhrase) throws PlexusCipherException
Description copied from interface:PlexusCipher
decrypt given base64 encoded encrypted string. If string is decorated, decrypt base64 encoded string inside decorations- Specified by:
decryptDecorated
in interfacePlexusCipher
- Returns:
- Throws:
PlexusCipherException
-
isEncryptedString
public boolean isEncryptedString(String str)
Description copied from interface:PlexusCipher
check if given string is decorated- Specified by:
isEncryptedString
in interfacePlexusCipher
- Returns:
-
unDecorate
public String unDecorate(String str) throws PlexusCipherException
Description copied from interface:PlexusCipher
return string inside decorations- Specified by:
unDecorate
in interfacePlexusCipher
- Returns:
- Throws:
PlexusCipherException
-
decorate
public String decorate(String str)
Description copied from interface:PlexusCipher
decorated given string with { and }- Specified by:
decorate
in interfacePlexusCipher
- Returns:
-
getServiceTypes
public static String[] getServiceTypes()
Exploratory part. This method returns all available services types
-
getCryptoImpls
public static String[] getCryptoImpls(String serviceType)
This method returns the available implementations for a service type
-
main
public static void main(String[] args)
-
-