Dropwizard Crypto Parent

A Dropwizard Bundle for encrypting configuration and data.

License

License

Categories

Categories

DropWizard Container Microservices
GroupId

GroupId

com.meltmedia.dropwizard
ArtifactId

ArtifactId

dropwizard-crypto-parent
Last Version

Last Version

0.3.1
Release Date

Release Date

Type

Type

pom
Description

Description

Dropwizard Crypto Parent
A Dropwizard Bundle for encrypting configuration and data.
Project URL

Project URL

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

Project Organization

meltmedia
Source Code Management

Source Code Management

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

Download dropwizard-crypto-parent

How to add to project

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

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • bundle
  • example

Dropwizard Crypto

A Dropwizard bundle that adds encryption support to an application's ObjectMapper.

Build Status

Usage

Maven

This project releases to Maven Central. To use the bundle, simply include its dependency in your project.

<dependency>
  <groupId>com.meltmedia.dropwizard</groupId>
  <artifactId>dropwizard-crypto</artifactId>
  <version>0.3.1</version>
</dependency>

To use SNAPSHOTs of this project, you will need to include the sonatype repository in your POM.

<repositories>
    <repository>
        <snapshots>
        <enabled>true</enabled>
        </snapshots>
        <id>sonatype-nexus-snapshots</id>
        <name>Sonatype Nexus Snapshots</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>
</repositories>

Java

Include the bundle in the initialize method of your application:

import com.meltmedia.dropwizard.crypto.CryptoBundle;

...

@Override
public void initialize(Bootstrap<MyConfiguration> bootstrap) {
  bootstrap.addBundle(
    CryptoBundle
      .builder().build());
}

And include the @Encrypted annotations on your Configuration object's encrypted properties:

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

Environment

When running your application, define the passphrase in the environment.

export DROPWIZARD_PASSPHRASE='correct horse battery staple'

Configuration

Create an unencrypted version of your configuration.

secret: secret

Then pass it through the encryption command.

dropwizard-app encrypt -p /secret unencrypted.yml encrypted.yml

This will give you an encrypted version of your config.

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

Running

Run any of your application's configured commands like you normally would, just pass in a version of the configuration with encrypted values.

dropwizard-app server encrypted.yml

Building

This project builds with Java8 and Maven 3. Simply clone the repo and run

mvn clean install

from the root directory.

Contributing

This project accepts PRs, so feel free to fork the project and send contributions back.

Formatting

This project contains formatters to help keep the code base consistent. The formatter will update Java source files and add headers to other files. When running the formatter, I suggest the following procedure:

  1. Make sure any outstanding stages are staged. This will prevent the formatter from destroying your code.
  2. Run mvn format, this will format the source and add any missing license headers.
  3. If the changes look good and the project still compiles, add the formatting changes to your staged code.

If things go wrong, you can run git checkout -- . to drop the formatting changes.

com.meltmedia.dropwizard

Meltmedia

Versions

Version
0.3.1
0.3.0
0.2.0
0.1.0