#9772 improve QuicServerConnector key+crt export folder

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2023-05-15 11:36:04 +02:00
parent b24c180749
commit 07a1c124f2
2 changed files with 19 additions and 1 deletions

View File

@ -12,6 +12,7 @@ experimental
http2
jna
quiche
work
[lib]
lib/http3/*.jar

View File

@ -174,11 +174,28 @@ public class QuicServerConnector extends AbstractNetworkConnector
alias,
password
);
Path[] pemFiles = keyPair.export(Path.of(System.getProperty("java.io.tmpdir")));
Path[] pemFiles = keyPair.export(findTargetPath());
privateKeyPath = pemFiles[0];
certificateChainPath = pemFiles[1];
}
private Path findTargetPath() throws IOException
{
Path target;
String jettyBase = System.getProperty("jetty.base");
if (jettyBase != null)
{
target = Path.of(jettyBase).resolve("work");
}
else
{
target = sslContextFactory.getKeyStoreResource().getFile().getParentFile().toPath();
if (!Files.isDirectory(target))
target = Path.of(".");
}
return target;
}
@Override
public void open() throws IOException
{