Class EncryptionUtil
java.lang.Object
de.hybris.platform.util.encryption.EncryptionUtil
Helper class for maintenance_reciper.jsp, maintenance_keygenerator.jsp (admin > maintenance > encryption key
management) and de.hybris.platform.util.encryption.ValueEncryptor
Rewrites the encrypted attribute with the configured default encyrption key (symmetric.key.file.default)
see project.properties
# attribute encryption
# keyfile location: ${platformhome}/ext/core/resources/
...
symmetric.key.file.1=weak-symmetric.key.one
symmetric.key.file.2=weak-symmetric.key.two
symmetric.key.file.default=2
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringasHex(byte[] buf) Turns array of bytes into stringstatic booleanstatic booleangenerateAESKey(String keyfile, int keysize) static Map<ComposedType,List<AttributeDescriptor>> static Map<ComposedType,List<AttributeDescriptor>> getAllTypesWhichHasEncyrptedAttributes(Predicate<ComposedType> typeFilter) protected static ConfigIntfDeprecated, for removal: This API element is subject to removal in a future version.static Stringstatic Stringstatic Stringstatic final PBEParameterSpecstatic final byte[]getUsedKeys(String type, String qualifier) Returns used keysgetUsedKeys(String type, String qualifier, JspContext jspc) Deprecated, for removal: This API element is subject to removal in a future version.since 1811static booleanstatic booleanisNewStyleKey(String keyfile) static SecretKeyloadDefaultKey(String cipherName, String cipherAlgorithm, char[] password) static SecretKeyloadKey(InputStream fis, String cipherName, String cipherAlgorithm, char[] password) static SecretKeystatic SecretKeyvoidstatic voidmigrate(String type, String qualifier, JspContext jspc) Performance (MacBook Pro/MySQL 5): Time: 1742901 m/s for '200100' steps-- 8 ms/stepstatic voidsetKeyfiles(Map<String, String> keyfiles)
-
Field Details
-
SUBFOLDER
- See Also:
-
PROVIDER_CLASS
- See Also:
-
DEFAULT_KEYFILE_NAME
- See Also:
-
-
Constructor Details
-
EncryptionUtil
public EncryptionUtil()
-
-
Method Details
-
setKeyfiles
-
getDefaultKeyFileName
-
getDefaultKeyFileId
-
getConfig
-
getOldKeyFile
-
getSecretKeysFromConfig
-
getConfiguredEncryptionKeys
-
isConfiguredMigrationKey
public static boolean isConfiguredMigrationKey() -
getConfiguredEncryptionKey
Deprecated, for removal: This API element is subject to removal in a future version.since 1905 in favor ofgetConfiguredEncryptionKeys() -
migrate
-
migrate
Performance (MacBook Pro/MySQL 5): Time: 1742901 m/s for '200100' steps-- 8 ms/step- Parameters:
type- code of the ComposedTtypequalifier- name of the encrypted attributejspc- jspContext
-
getUsedKeys
Returns used keys- Parameters:
type- type to get keys forqualifier- attribute name in given type- Returns:
- keys
-
getUsedKeys
@Deprecated(since="1811", forRemoval=true) public Map<String,Integer> getUsedKeys(String type, String qualifier, JspContext jspc) Deprecated, for removal: This API element is subject to removal in a future version.since 1811Returns used keys- Parameters:
type- type to get keys forqualifier- attribute name in given typejspc- jspContext- Returns:
-
getAllTypesWhichHasEncyrptedAttributes
public static Map<ComposedType,List<AttributeDescriptor>> getAllTypesWhichHasEncyrptedAttributes(Predicate<ComposedType> typeFilter) -
getAllTypesWhichHasEncyrptedAttributes
-
generateAESKey
public static boolean generateAESKey(String keyfile, int keysize) throws GeneralSecurityException, IOException - Throws:
GeneralSecurityExceptionIOException
-
createKey
public static boolean createKey(String filename, int keysize, String cipherName, String cipherAlgorithm, char[] password) throws GeneralSecurityException, IOException - Throws:
GeneralSecurityExceptionIOException
-
loadKey
- Throws:
GeneralSecurityExceptionIOException
-
loadDefaultKey
public static SecretKey loadDefaultKey(String cipherName, String cipherAlgorithm, char[] password) throws InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException, IOException -
loadKey
-
loadKey
public static SecretKey loadKey(InputStream fis, String cipherName, String cipherAlgorithm, char[] password) throws IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidKeySpecException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException -
getOldSalt
public static final byte[] getOldSalt() -
getOldPBEParameterSpec
-
isNewStyleKey
-
asHex
Turns array of bytes into string- Parameters:
buf- Array of bytes to convert to hex string- Returns:
- Generated hex string
-
getConfiguredEncryptionKeys()