Class DefaultPlexusCipher
java.lang.Object
org.sonatype.plexus.components.cipher.DefaultPlexusCipher
- All Implemented Interfaces:
PlexusCipher
@Singleton
@Named("default")
@Typed(PlexusCipher.class)
public class DefaultPlexusCipher
extends Object
implements PlexusCipher
Default implementation of
PlexusCipher
. This class is thread safe.-
Field Summary
FieldsFields inherited from interface org.sonatype.plexus.components.cipher.PlexusCipher
ENCRYPTED_STRING_DECORATION_START, ENCRYPTED_STRING_DECORATION_STOP
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecorated given string with { and }decrypt given base64 encrypted stringdecryptDecorated
(String str, String passPhrase) decrypt given base64 encoded encrypted string.encrypt given string with the given passPhrase and encode it into base64encryptAndDecorate
(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[]
Exploratory part.boolean
isEncryptedString
(String str) check if given string is decoratedstatic void
unDecorate
(String str) return string inside decorations
-
Field Details
-
ENCRYPTED_STRING_PATTERN
-
_cipher
-
-
Constructor Details
-
DefaultPlexusCipher
public DefaultPlexusCipher()
-
-
Method Details
-
encrypt
Description copied from interface:PlexusCipher
encrypt given string with the given passPhrase and encode it into base64- Specified by:
encrypt
in interfacePlexusCipher
- Parameters:
str
- string to encryptpassPhrase
- pass phrase- Returns:
- encrypted str
- Throws:
PlexusCipherException
- if encryption fails
-
encryptAndDecorate
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
- Parameters:
str
- string to encryptpassPhrase
- pass phrase- Returns:
- encrypted and decorated str
- Throws:
PlexusCipherException
- if encryption fails
-
decrypt
Description copied from interface:PlexusCipher
decrypt given base64 encrypted string- Specified by:
decrypt
in interfacePlexusCipher
- Parameters:
str
- base64 encoded stringpassPhrase
- pass phrase- Returns:
- decrypted str
- Throws:
PlexusCipherException
- if decryption fails
-
decryptDecorated
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
- Parameters:
str
- base64 encoded stringpassPhrase
- pass phrase- Returns:
- decrypted decorated str
- Throws:
PlexusCipherException
- if decryption fails
-
isEncryptedString
Description copied from interface:PlexusCipher
check if given string is decorated- Specified by:
isEncryptedString
in interfacePlexusCipher
- Parameters:
str
- string to check- Returns:
- true if string is encrypted
-
unDecorate
Description copied from interface:PlexusCipher
return string inside decorations- Specified by:
unDecorate
in interfacePlexusCipher
- Parameters:
str
- decorated string- Returns:
- undecorated str
- Throws:
PlexusCipherException
- if decryption fails
-
decorate
Description copied from interface:PlexusCipher
decorated given string with { and }- Specified by:
decorate
in interfacePlexusCipher
- Parameters:
str
- string to decorate- Returns:
- decorated str
-
getServiceTypes
Exploratory part. This method returns all available services types -
getCryptoImpls
This method returns the available implementations for a service type -
main
-