Package com.bld.crypto.bean
Class CryptoKeyUtils
java.lang.Object
com.bld.crypto.bean.CryptoKeyUtils
- Direct Known Subclasses:
CryptoAesUtils,CryptoJksUtils,CryptoPublicKeyUtils
The Class CryptoKeyUtils.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.fasterxml.jackson.databind.ObjectMapperThe obj mapper. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringdecryptUri(String value, String key) Decrypt uri.protected abstract StringdecryptValue(String value, String key) Decrypt value.decryptValue(String value, Key key, InstanceType instanceType) Decrypt value.protected StringencodeValue(String valueEncrypted) Encode value.protected StringencryptUri(String value, String key) Encrypt uri.protected abstract StringencryptValue(String value, String key) Encrypt value.static StringencryptValue(String value, Key key, InstanceType instanceType) Encrypt value.protected static CiphergetCipher(int mode, Key key, InstanceType instanceType) Gets the cipher.
-
Field Details
-
objMapper
@Autowired protected com.fasterxml.jackson.databind.ObjectMapper objMapperThe obj mapper.
-
-
Constructor Details
-
CryptoKeyUtils
public CryptoKeyUtils()
-
-
Method Details
-
getCipher
protected static Cipher getCipher(int mode, Key key, InstanceType instanceType) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException Gets the cipher.- Parameters:
mode- the modekey- the keyinstanceType- the instance type- Returns:
- the cipher
- Throws:
NoSuchAlgorithmException- the no such algorithm exceptionNoSuchPaddingException- the no such padding exceptionInvalidKeyException- the invalid key exception
-
encryptValue
Encrypt value.- Parameters:
value- the valuekey- the keyinstanceType- the instance type- Returns:
- the string
-
decryptValue
Decrypt value.- Parameters:
value- the valuekey- the keyinstanceType- the instance type- Returns:
- the string
-
encryptValue
Encrypt value.- Parameters:
value- the valuekey- the key- Returns:
- the string
-
decryptValue
Decrypt value.- Parameters:
value- the valuekey- the key- Returns:
- the string
-
encryptUri
Encrypt uri.- Parameters:
value- the valuekey- the key- Returns:
- the string
-
encodeValue
Encode value.- Parameters:
valueEncrypted- the value encrypted- Returns:
- the string
-
decryptUri
Decrypt uri.- Parameters:
value- the valuekey- the key- Returns:
- the string
-