Class MongoEncryptionConverter
java.lang.Object
org.springframework.data.mongodb.core.convert.encryption.MongoEncryptionConverter
- All Implemented Interfaces:
PropertyValueConverter<Object, Object, MongoConversionContext>, EncryptingConverter<Object,Object>, MongoValueConverter<Object, Object>
Default implementation of
EncryptingConverter. Properties used with this converter must be annotated with
@Encrypted to provide key and algorithm metadata.- Since:
- 4.1
- Author:
- Christoph Strobl, Ross Lawley
-
Nested Class Summary
Nested classes/interfaces inherited from interface PropertyValueConverter
PropertyValueConverter.FunctionPropertyValueConverter<DV,SV, P>, PropertyValueConverter.ObjectToObjectPropertyValueConverter -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMongoEncryptionConverter(Encryption<org.bson.BsonValue, org.bson.BsonBinary> encryption, EncryptionKeyResolver keyResolver) -
Method Summary
Modifier and TypeMethodDescriptionObtain theEncryptionContextfor a givenvalue conversion context.@Nullable Objectdecrypt(Object encryptedValue, EncryptionContext context) Decrypt the given encrypted source value within the givencontext.encrypt(@Nullable Object value, EncryptionContext context) Encrypt the given raw source value within the givencontext.protected MongoPersistentPropertygetProperty(EncryptionContext context) @Nullable Objectread(Object value, MongoConversionContext context) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EncryptingConverter
writeMethods inherited from interface PropertyValueConverter
readNull, writeNull
-
Field Details
-
AND_OPERATOR
- See Also:
-
-
Constructor Details
-
MongoEncryptionConverter
public MongoEncryptionConverter(Encryption<org.bson.BsonValue, org.bson.BsonBinary> encryption, EncryptionKeyResolver keyResolver)
-
-
Method Details
-
read
- Specified by:
readin interfaceEncryptingConverter<Object,Object> - Specified by:
readin interfacePropertyValueConverter<Object, Object, MongoConversionContext>
-
decrypt
Description copied from interface:EncryptingConverterDecrypt the given encrypted source value within the givencontext.- Specified by:
decryptin interfaceEncryptingConverter<Object,Object> - Parameters:
encryptedValue- the encrypted source.context- the context to operate in.- Returns:
- never null.
-
encrypt
Description copied from interface:EncryptingConverterEncrypt the given raw source value within the givencontext.- Specified by:
encryptin interfaceEncryptingConverter<Object,Object> - Parameters:
value- the encrypted source.context- the context to operate in.- Returns:
- never null.
-
buildEncryptionContext
Description copied from interface:EncryptingConverterObtain theEncryptionContextfor a givenvalue conversion context.- Specified by:
buildEncryptionContextin interfaceEncryptingConverter<Object,Object> - Parameters:
context- the current MongoDB specificValueConversionContext.- Returns:
- the
EncryptionContextto operate in. - See Also:
-
getProperty
-