Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/meltmedia/dropwizard-crypto
A Crytpographic Bundle for Dropwizard
https://github.com/meltmedia/dropwizard-crypto
cryptography dropwizard dropwizard-bundle encryption java
Last synced: 2 months ago
JSON representation
A Crytpographic Bundle for Dropwizard
- Host: GitHub
- URL: https://github.com/meltmedia/dropwizard-crypto
- Owner: meltmedia
- License: apache-2.0
- Created: 2014-11-19T05:05:02.000Z (about 10 years ago)
- Default Branch: develop
- Last Pushed: 2017-11-14T17:22:27.000Z (about 7 years ago)
- Last Synced: 2024-04-14T02:18:18.169Z (9 months ago)
- Topics: cryptography, dropwizard, dropwizard-bundle, encryption, java
- Language: Java
- Size: 49.8 KB
- Stars: 13
- Watchers: 4
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-dropwizard - dropwizard-crypto - A Cryptographic Bundle for Dropwizard (Open Source / Eclipse)
README
# Dropwizard Crypto
A Dropwizard bundle that adds encryption support to an application's ObjectMapper.
[![Build Status](https://travis-ci.org/meltmedia/dropwizard-crypto.svg)](https://travis-ci.org/meltmedia/dropwizard-crypto)
## Usage
### Maven
This project releases to Maven Central. To use the bundle, simply include its dependency in your project.
```
com.meltmedia.dropwizard
dropwizard-crypto
0.3.1```
To use SNAPSHOTs of this project, you will need to include the sonatype repository in your POM.
```
true
sonatype-nexus-snapshots
Sonatype Nexus Snapshots
https://oss.sonatype.org/content/repositories/snapshots
```
### Java
Include the bundle in the `initialize` method of your application:
```
import com.meltmedia.dropwizard.crypto.CryptoBundle;...
@Override
public void initialize(Bootstrap 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.