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 Stringdecorate(String str)decorated given string with { and }Stringdecrypt(String str, String passPhrase)decrypt given base64 encrypted stringStringdecryptDecorated(String str, String passPhrase)decrypt given base64 encoded encrypted string.Stringencrypt(String str, String passPhrase)encrypt given string with the given passPhrase and encode it into base64StringencryptAndDecorate(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.booleanisEncryptedString(String str)check if given string is decoratedstatic voidmain(String[] args)StringunDecorate(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:PlexusCipherencrypt given string with the given passPhrase and encode it into base64- Specified by:
encryptin interfacePlexusCipher- Returns:
- Throws:
PlexusCipherException
-
encryptAndDecorate
public String encryptAndDecorate(String str, String passPhrase) throws PlexusCipherException
Description copied from interface:PlexusCipherencrypt given string with the given passPhrase, encode it into base64 and return result, wrapped into { } decorations- Specified by:
encryptAndDecoratein interfacePlexusCipher- Returns:
- Throws:
PlexusCipherException
-
decrypt
public String decrypt(String str, String passPhrase) throws PlexusCipherException
Description copied from interface:PlexusCipherdecrypt given base64 encrypted string- Specified by:
decryptin interfacePlexusCipher- Returns:
- Throws:
PlexusCipherException
-
decryptDecorated
public String decryptDecorated(String str, String passPhrase) throws PlexusCipherException
Description copied from interface:PlexusCipherdecrypt given base64 encoded encrypted string. If string is decorated, decrypt base64 encoded string inside decorations- Specified by:
decryptDecoratedin interfacePlexusCipher- Returns:
- Throws:
PlexusCipherException
-
isEncryptedString
public boolean isEncryptedString(String str)
Description copied from interface:PlexusCiphercheck if given string is decorated- Specified by:
isEncryptedStringin interfacePlexusCipher- Returns:
-
unDecorate
public String unDecorate(String str) throws PlexusCipherException
Description copied from interface:PlexusCipherreturn string inside decorations- Specified by:
unDecoratein interfacePlexusCipher- Returns:
- Throws:
PlexusCipherException
-
decorate
public String decorate(String str)
Description copied from interface:PlexusCipherdecorated given string with { and }- Specified by:
decoratein 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)
-
-