diff options
author | Bjørn Christian Seime <bjorncs@oath.com> | 2018-05-11 14:00:36 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@oath.com> | 2018-05-11 18:10:23 +0200 |
commit | 079630225e7d3a543209914361836970a80b83a9 (patch) | |
tree | 83da7ddf81053a65d282575a58014ced80ca5e66 /vespa-athenz | |
parent | 0b179297cc173a7c32689bbb18c67c0de30f6264 (diff) |
Add overloaded method taking Path instead of File
Diffstat (limited to 'vespa-athenz')
-rw-r--r-- | vespa-athenz/src/main/java/com/yahoo/vespa/athenz/tls/SslContextBuilder.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/tls/SslContextBuilder.java b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/tls/SslContextBuilder.java index 54413a47815..ba5785043da 100644 --- a/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/tls/SslContextBuilder.java +++ b/vespa-athenz/src/main/java/com/yahoo/vespa/athenz/tls/SslContextBuilder.java @@ -10,6 +10,7 @@ import java.io.File; import java.io.IOException; import java.io.UncheckedIOException; import java.nio.file.Files; +import java.nio.file.Path; import java.security.GeneralSecurityException; import java.security.KeyStore; import java.security.PrivateKey; @@ -56,10 +57,14 @@ public class SslContextBuilder { } public SslContextBuilder withKeyStore(File privateKeyPemFile, File certificatePemFile) { + return withKeyStore(privateKeyPemFile.toPath(), certificatePemFile.toPath()); + } + + public SslContextBuilder withKeyStore(Path privateKeyPemFile, Path certificatePemFile) { this.keyStoreSupplier = () -> { - PrivateKey privateKey = KeyUtils.fromPemEncodedPrivateKey(new String(Files.readAllBytes(privateKeyPemFile.toPath()))); - X509Certificate certificate = X509CertificateUtils.fromPem(new String(Files.readAllBytes(certificatePemFile.toPath()))); + PrivateKey privateKey = KeyUtils.fromPemEncodedPrivateKey(new String(Files.readAllBytes(privateKeyPemFile))); + X509Certificate certificate = X509CertificateUtils.fromPem(new String(Files.readAllBytes(certificatePemFile))); return KeyStoreBuilder.withType(KeyStoreType.JKS) .withKeyEntry("default", privateKey, certificate) .build(); |