-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from stempler/feature/encyrption
first version of support for encrypted configuration files
- Loading branch information
Showing
11 changed files
with
518 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,8 @@ class SetupConfiguration { | |
|
||
File stackFile | ||
|
||
File setupDir | ||
|
||
String stackName | ||
|
||
String setupName | ||
|
42 changes: 42 additions & 0 deletions
42
src/main/groovy/to/wetransform/gradle/swarm/crypt/ConfigCryptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) 2017 wetransform GmbH | ||
* All rights reserved. | ||
*/ | ||
|
||
package to.wetransform.gradle.swarm.crypt; | ||
|
||
import java.util.Map; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* Interface for configuration encryption/decryption. | ||
* | ||
* @author Simon Templer | ||
*/ | ||
public interface ConfigCryptor { | ||
|
||
/** | ||
* Encrypt the (string) settings in the given configuration and return the | ||
* encrypted version of the configuration. | ||
* The encryptor may mutate the given configuration and return it or create a new configuration. | ||
* | ||
* @param config the configuration | ||
* @param password the password | ||
* @param reference an already encrypted reference configuration (to reuse existing encryptions) | ||
* @return the encrypted configuration | ||
*/ | ||
Map<String, Object> encrypt(Map<String, Object> config, String password, @Nullable Map<String, Object> reference) throws Exception; | ||
|
||
/** | ||
* Decrypt the (string) settings in the given configuration and return the | ||
* decrypted version of the configuration. | ||
* The decryptor may mutate the given configuration and return it or create a new configuration. | ||
* | ||
* @param config the configuration | ||
* @param password the password | ||
* @return the decrypted configuration | ||
*/ | ||
Map<String, Object> decrypt(Map<String, Object> config, String password) throws Exception; | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
src/main/groovy/to/wetransform/gradle/swarm/crypt/Cryptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright (c) 2017 wetransform GmbH | ||
* All rights reserved. | ||
*/ | ||
|
||
package to.wetransform.gradle.swarm.crypt; | ||
|
||
/** | ||
* Encryption and decryption interface. | ||
* | ||
* @author Simon Templer | ||
*/ | ||
public interface Cryptor { | ||
|
||
String encrypt(String plain, String password) throws Exception; | ||
|
||
String decrypt(String encrypted, String password) throws Exception; | ||
|
||
} |
Oops, something went wrong.