Class CryptoUtil
java.lang.Object
com.evolveum.midpoint.common.crypto.CryptoUtil
- Author:
- semancik
-
Field Summary
FieldsModifier and TypeFieldDescriptionItems that may contain clear-text values in stored objects: these were plain strings before 4.11 and are encrypted only when modified. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends ObjectType>
voidcheckEncrypted(ObjectDelta<T> delta) static <T extends ObjectType>
voidcheckEncrypted(PrismObject<T> object) static <T extends ObjectType>
voidcheckEncrypted(PrismObject<T> object, @NotNull Collection<ItemPath> toleratedClearTextPaths) Checks that everything is encrypted, except for values at the tolerated paths.static voidcheckEncrypted(Collection<? extends ItemDelta> modifications) static <T extends ObjectType>
Collection<? extends ItemDelta<?, ?>> computeReencryptModifications(Protector protector, PrismObject<T> object) static <T extends ObjectType>
booleancontainsCleartext(PrismObject<T> object) static <T extends ObjectType>
booleancontainsHashedData(PrismObject<T> object) static <T extends ObjectType>
voidencryptValues(Protector protector, ObjectDelta<T> delta) Encrypts all encryptable values in delta.static <T extends ObjectType>
voidencryptValues(Protector protector, PrismObject<T> object) Encrypts all encryptable values in the object.static <T extends ObjectType>
@NotNull Collection<String> getEncryptionKeyNames(PrismObject<T> object) static <T extends ObjectType>
intreencryptValues(Protector protector, PrismObject<T> object) Re-encrypts all encryptable values in the object.static voidsecuritySelfTest(OperationResult parentTestResult)
-
Field Details
-
LEGACY_CLEAR_TEXT_PATHS
Items that may contain clear-text values in stored objects: these were plain strings before 4.11 and are encrypted only when modified. The encryption checks of stored objects tolerate them; everything else must be encrypted.
-
-
Constructor Details
-
CryptoUtil
public CryptoUtil()
-
-
Method Details
-
encryptValues
public static <T extends ObjectType> void encryptValues(Protector protector, PrismObject<T> object) throws EncryptionException Encrypts all encryptable values in the object.Note: We could use TunnelException here (it would be cleaner) but the tunneled exception could be other than EncryptionException! For example, it could come from RawType, carrying a SchemaException. See MID-6086. So we use throwExceptionAsUnchecked hack instead.
- Throws:
EncryptionException
-
encryptValues
public static <T extends ObjectType> void encryptValues(Protector protector, ObjectDelta<T> delta) throws EncryptionException Encrypts all encryptable values in delta.- Throws:
EncryptionException
-
checkEncrypted
-
checkEncrypted
public static <T extends ObjectType> void checkEncrypted(PrismObject<T> object, @NotNull @NotNull Collection<ItemPath> toleratedClearTextPaths) Checks that everything is encrypted, except for values at the tolerated paths. This is meant for data that was stored as clear text by older versions and is encrypted only when modified.- Parameters:
toleratedClearTextPaths- paths of values that are allowed to be clear text -> whole path must not contain any multi-value segments
-
checkEncrypted
-
checkEncrypted
-
securitySelfTest
-
computeReencryptModifications
public static <T extends ObjectType> Collection<? extends ItemDelta<?,?>> computeReencryptModifications(Protector protector, PrismObject<T> object) throws EncryptionException - Throws:
EncryptionException
-
reencryptValues
public static <T extends ObjectType> int reencryptValues(Protector protector, PrismObject<T> object) throws EncryptionException Re-encrypts all encryptable values in the object.- Throws:
EncryptionException
-
getEncryptionKeyNames
@NotNull public static <T extends ObjectType> @NotNull Collection<String> getEncryptionKeyNames(PrismObject<T> object) -
containsCleartext
-
containsHashedData
-