Package com.bld.crypto.hmac.serializer
Class EncryptHmacSerializer<T>
java.lang.Object
com.fasterxml.jackson.databind.JsonSerializer<T>
com.fasterxml.jackson.databind.ser.std.StdSerializer<T>
com.fasterxml.jackson.databind.ser.std.StdScalarSerializer<T>
com.bld.crypto.serializer.EncryptCertificateSerializer<T>
com.bld.crypto.hmac.serializer.EncryptHmacSerializer<T>
- Type Parameters:
T- the type of the value to sign
- All Implemented Interfaces:
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable,com.fasterxml.jackson.databind.jsonschema.SchemaAware,com.fasterxml.jackson.databind.ser.ContextualSerializer,Serializable
public class EncryptHmacSerializer<T>
extends EncryptCertificateSerializer<T>
implements com.fasterxml.jackson.databind.ser.ContextualSerializer
Jackson
ContextualSerializer that signs a field value before writing it
to the JSON output stream using HMAC.
The plain-text value is wrapped in a JSON envelope
{"key":"<annotationValue>","value":"<plainText>"} and then signed.
The envelope is verified during deserialisation to prevent cross-field substitution.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer
com.fasterxml.jackson.databind.JsonSerializer.None -
Field Summary
Fields inherited from class com.bld.crypto.serializer.EncryptCertificateSerializer
objMapperFields inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer
_handledType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.jackson.databind.JsonSerializer<?> createContextual(com.fasterxml.jackson.databind.SerializerProvider prov, com.fasterxml.jackson.databind.BeanProperty property) protected StringencryptValue(String word) Encrypts the given plain-text string.Methods inherited from class com.bld.crypto.serializer.EncryptCertificateSerializer
serializeMethods inherited from class com.fasterxml.jackson.databind.ser.std.StdScalarSerializer
acceptJsonFormatVisitor, getSchema, serializeWithTypeMethods inherited from class com.fasterxml.jackson.databind.ser.std.StdSerializer
_neitherNull, _nonEmpty, createSchemaNode, createSchemaNode, findAnnotatedContentSerializer, findContextualConvertingSerializer, findConvertingContentSerializer, findFormatFeature, findFormatOverrides, findIncludeOverrides, findPropertyFilter, getSchema, handledType, isDefaultSerializer, visitArrayFormat, visitArrayFormat, visitFloatFormat, visitIntFormat, visitIntFormat, visitStringFormat, visitStringFormat, wrapAndThrow, wrapAndThrowMethods inherited from class com.fasterxml.jackson.databind.JsonSerializer
getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, unwrappingSerializer, usesObjectId, withFilterId, withIgnoredProperties
-
Constructor Details
-
EncryptHmacSerializer
public EncryptHmacSerializer()
-
-
Method Details
-
createContextual
public com.fasterxml.jackson.databind.JsonSerializer<?> createContextual(com.fasterxml.jackson.databind.SerializerProvider prov, com.fasterxml.jackson.databind.BeanProperty property) throws com.fasterxml.jackson.databind.JsonMappingException - Specified by:
createContextualin interfacecom.fasterxml.jackson.databind.ser.ContextualSerializer- Throws:
com.fasterxml.jackson.databind.JsonMappingException
-
encryptValue
Description copied from class:EncryptCertificateSerializerEncrypts the given plain-text string. Concrete subclasses supply the algorithm and key selection logic.- Specified by:
encryptValuein classEncryptCertificateSerializer<T>- Parameters:
word- the plain-text string to encrypt- Returns:
- the encrypted, Base64-encoded string
-