Jackson Crypto

A Jackson Module for encrypting JSON.

License

License

Categories

Categories

Jackson Data JSON
GroupId

GroupId

com.meltmedia.jackson
ArtifactId

ArtifactId

jackson-crypto
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

Jackson Crypto
A Jackson Module for encrypting JSON.
Project URL

Project URL

http://github.com/meltmedia/jackson-crypto
Project Organization

Project Organization

meltmedia
Source Code Management

Source Code Management

https://github.com/meltmedia/jackson-crypto

Download jackson-crypto

How to add to project

<!-- https://jarcasting.com/artifacts/com.meltmedia.jackson/jackson-crypto/ -->
<dependency>
    <groupId>com.meltmedia.jackson</groupId>
    <artifactId>jackson-crypto</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.meltmedia.jackson/jackson-crypto/
implementation 'com.meltmedia.jackson:jackson-crypto:0.2.0'
// https://jarcasting.com/artifacts/com.meltmedia.jackson/jackson-crypto/
implementation ("com.meltmedia.jackson:jackson-crypto:0.2.0")
'com.meltmedia.jackson:jackson-crypto:jar:0.2.0'
<dependency org="com.meltmedia.jackson" name="jackson-crypto" rev="0.2.0">
  <artifact name="jackson-crypto" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.meltmedia.jackson', module='jackson-crypto', version='0.2.0')
)
libraryDependencies += "com.meltmedia.jackson" % "jackson-crypto" % "0.2.0"
[com.meltmedia.jackson/jackson-crypto "0.2.0"]

Dependencies

compile (7)

Group / Artifact Type Version
com.fasterxml.jackson.core : jackson-annotations jar 2.4.3
com.fasterxml.jackson.core : jackson-core jar 2.4.3
com.fasterxml.jackson.core : jackson-databind jar 2.4.3
javax.el : javax.el-api jar 2.2.4
org.apache.commons : commons-lang3 jar 3.3.2
org.hibernate : hibernate-validator jar 5.1.3.Final
org.slf4j : slf4j-api jar 1.7.5

test (6)

Group / Artifact Type Version
com.carrotsearch : junit-benchmarks jar 0.7.2
com.google.guava : guava jar 18.0
commons-codec : commons-codec jar 1.9
junit : junit jar 4.11
org.hamcrest : hamcrest-all jar 1.3
org.mockito : mockito-all jar 1.10.8

Project Modules

There are no modules declared in this project.

Jackson Crypto

Build Status

Cryptographic utilities for Jackson.

Usage

To use this package from Maven, include the following dependency in your project:

<dependency>
  <groupId>com.meltmedia.jackson</groupId>
  <artifactId>jackson-crypto</artifactId>
  <version>0.2.0</version>
</dpendency>

Then create a new CryptoModule and register it with your ObjectMapper.

EncryptionService service = ...;
ObjectMapper mapper = ...;
mapper.registerModule(new CryptoModule().addSource(service));

Once this is done, you can use the @Encrypted annotation on your @JsonProperty annotated methods to encrypt them during serialization and decrypt them during deserialization. So, a POJO like the following:

public class Pojo {
  protected String secret;

  @JsonProperty
  @Encrypted
  public String getSecret() {
    return this.secret;
  }

  public void setSecret( String secret ) {
    this.secret = secret;
  }
}

will serialize into JSON like:

{
  "secret": {
    "salt": "tKD8wQ==",
    "iv": "s9hTJRaZn6fxxpA4nVfDag==",
    "value": "UZENJOltf+9EZS03AXbmeg==",
    "cipher": "aes-256-cbc",
    "keyDerivation": "pbkdf2",
    "keyLength": 256,
    "iterations": 2000
  }
}

Example

This project does not yet have its own example project, but you can see an example of using this library in the Dropwizard Crypto example project.

com.meltmedia.jackson

Meltmedia

Versions

Version
0.2.0
0.1.0