-
Notifications
You must be signed in to change notification settings - Fork 0
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 #4 from inomera/fea/fb/2-loading-ssl-cert-from-config
Add PEM-based SSL support
- Loading branch information
Showing
22 changed files
with
1,883 additions
and
65 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
83 changes: 83 additions & 0 deletions
83
...ntegration/src/main/java/com/inomera/integration/config/model/PemSSLBundleProperties.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,83 @@ | ||
package com.inomera.integration.config.model; | ||
|
||
/** | ||
* {@link SSLBundleProperties} for PEM-encoded certificates and private keys. | ||
*/ | ||
public class PemSSLBundleProperties extends SSLBundleProperties { | ||
/** | ||
* Keystore properties. | ||
*/ | ||
private final Store keystore = new Store(); | ||
|
||
/** | ||
* Truststore properties. | ||
*/ | ||
private final Store truststore = new Store(); | ||
|
||
/** | ||
* Store properties. | ||
*/ | ||
public static class Store { | ||
|
||
/** | ||
* Type of the store to create, e.g. JKS. | ||
*/ | ||
private String type; | ||
|
||
/** | ||
* Location or content of the certificate or certificate chain in PEM format. | ||
*/ | ||
private String certificate; | ||
|
||
/** | ||
* Location or content of the private key in PEM format. | ||
*/ | ||
private String privateKey; | ||
|
||
/** | ||
* Password used to decrypt an encrypted private key. | ||
*/ | ||
private String privateKeyPassword; | ||
|
||
public String getType() { | ||
return this.type; | ||
} | ||
|
||
public void setType(String type) { | ||
this.type = type; | ||
} | ||
|
||
public String getCertificate() { | ||
return this.certificate; | ||
} | ||
|
||
public void setCertificate(String certificate) { | ||
this.certificate = certificate; | ||
} | ||
|
||
public String getPrivateKey() { | ||
return this.privateKey; | ||
} | ||
|
||
public void setPrivateKey(String privateKey) { | ||
this.privateKey = privateKey; | ||
} | ||
|
||
public String getPrivateKeyPassword() { | ||
return this.privateKeyPassword; | ||
} | ||
|
||
public void setPrivateKeyPassword(String privateKeyPassword) { | ||
this.privateKeyPassword = privateKeyPassword; | ||
} | ||
|
||
} | ||
|
||
public Store getKeystore() { | ||
return this.keystore; | ||
} | ||
|
||
public Store getTruststore() { | ||
return this.truststore; | ||
} | ||
} |
100 changes: 100 additions & 0 deletions
100
...o-integration/src/main/java/com/inomera/integration/config/model/SSLBundleProperties.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,100 @@ | ||
package com.inomera.integration.config.model; | ||
|
||
import java.util.Set; | ||
|
||
/** | ||
* Base class for SSL Bundle properties. | ||
*/ | ||
public abstract class SSLBundleProperties { | ||
|
||
/** | ||
* Key details for the bundle. | ||
*/ | ||
private final Key key = new Key(); | ||
|
||
/** | ||
* Options for the SLL connection. | ||
*/ | ||
private final Options options = new Options(); | ||
|
||
/** | ||
* SSL Protocol to use. | ||
*/ | ||
private String protocol = "TLS"; | ||
|
||
public Key getKey() { | ||
return this.key; | ||
} | ||
|
||
public Options getOptions() { | ||
return this.options; | ||
} | ||
|
||
public String getProtocol() { | ||
return this.protocol; | ||
} | ||
|
||
public void setProtocol(String protocol) { | ||
this.protocol = protocol; | ||
} | ||
|
||
public static class Options { | ||
|
||
/** | ||
* Supported SSL ciphers. | ||
*/ | ||
private Set<String> ciphers; | ||
|
||
/** | ||
* Enabled SSL protocols. | ||
*/ | ||
private Set<String> enabledProtocols; | ||
|
||
public Set<String> getCiphers() { | ||
return this.ciphers; | ||
} | ||
|
||
public void setCiphers(Set<String> ciphers) { | ||
this.ciphers = ciphers; | ||
} | ||
|
||
public Set<String> getEnabledProtocols() { | ||
return this.enabledProtocols; | ||
} | ||
|
||
public void setEnabledProtocols(Set<String> enabledProtocols) { | ||
this.enabledProtocols = enabledProtocols; | ||
} | ||
|
||
} | ||
|
||
public static class Key { | ||
|
||
/** | ||
* The password used to access the key in the key store. | ||
*/ | ||
private String password; | ||
|
||
/** | ||
* The alias that identifies the key in the key store. | ||
*/ | ||
private String alias; | ||
|
||
public String getPassword() { | ||
return this.password; | ||
} | ||
|
||
public void setPassword(String password) { | ||
this.password = password; | ||
} | ||
|
||
public String getAlias() { | ||
return this.alias; | ||
} | ||
|
||
public void setAlias(String alias) { | ||
this.alias = alias; | ||
} | ||
|
||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
micro-integration/src/main/java/com/inomera/integration/config/model/SSLProperties.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,16 @@ | ||
package com.inomera.integration.config.model; | ||
|
||
/** | ||
* Properties for centralized SSL trust material configuration. | ||
*/ | ||
public class SSLProperties { | ||
|
||
/** | ||
* PEM-encoded SSL trust material. | ||
*/ | ||
private final PemSSLBundleProperties pem = new PemSSLBundleProperties(); | ||
|
||
public PemSSLBundleProperties getPem() { | ||
return this.pem; | ||
} | ||
} |
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
Oops, something went wrong.