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 org.springframework.data.convert.PropertyValueConverter
PropertyValueConverter.FunctionPropertyValueConverter<DV, SV, P extends PersistentProperty<P>>, PropertyValueConverter.ObjectToObjectPropertyValueConverter
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMongoEncryptionConverter
(Encryption<org.bson.BsonValue, org.bson.BsonBinary> encryption, EncryptionKeyResolver keyResolver) -
Method Summary
Modifier and TypeMethodDescriptionObtain theEncryptionContext
for a givenvalue conversion context
.@Nullable Object
decrypt
(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 MongoPersistentProperty
getProperty
(EncryptionContext context) @Nullable Object
read
(Object value, MongoConversionContext context) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.mongodb.core.convert.encryption.EncryptingConverter
write
Methods inherited from interface org.springframework.data.convert.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:
read
in interfaceEncryptingConverter<Object,
Object> - Specified by:
read
in interfacePropertyValueConverter<Object, Object, MongoConversionContext>
-
decrypt
Description copied from interface:EncryptingConverter
Decrypt the given encrypted source value within the givencontext
.- Specified by:
decrypt
in interfaceEncryptingConverter<Object,
Object> - Parameters:
encryptedValue
- the encrypted source.context
- the context to operate in.- Returns:
- never null.
-
encrypt
Description copied from interface:EncryptingConverter
Encrypt the given raw source value within the givencontext
.- Specified by:
encrypt
in interfaceEncryptingConverter<Object,
Object> - Parameters:
value
- the encrypted source.context
- the context to operate in.- Returns:
- never null.
-
buildEncryptionContext
Description copied from interface:EncryptingConverter
Obtain theEncryptionContext
for a givenvalue conversion context
.- Specified by:
buildEncryptionContext
in interfaceEncryptingConverter<Object,
Object> - Parameters:
context
- the current MongoDB specificValueConversionContext
.- Returns:
- the
EncryptionContext
to operate in. - See Also:
-
getProperty
-