Re: ProtonJ2 loading key + trust from a jar

2023-01-27 Thread Timothy Bish

On 1/27/23 09:18, Segesten, Henrik wrote:

Hi

I am using ProtonJ2 as client for connecting to a broker which uses private key 
authentication and a custom trust store. I have managed to accomplish this by 
setting:

options.sslOptions().sslEnabled(true);

options.sslOptions().keyStoreLocation(keyStoreLocation);

options.sslOptions().keyStorePassword(keyStorePassword);

The problem I have is that these two locations are instantiated as java.File 
within ProtonJ2 which means that they need to exist in the file system, and I 
would like to package them within my single spring boot jar. I have not managed 
to accomplish this but have to put the two files next to the jar.

In my experience this could be solved if ProtonJ2 would load the files from a 
Path or URL instead which can reside within the jar.

Looking at the code I think this happens in 
https://github.com/apache/qpid-protonj2/blob/main/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/transport/netty5/SslSupport.java,
 private method loadStore at the end.

I would really appreciate any support in how I can resolve this in some other 
way than changing the code.

Best Regards


Henrik Segesten



The SslOptions provides a mechanism for providing your own SslContext 
which allows you to configure the key and trust stores using whatever 
mechanisms you see fit, thereby bypassing the inbuilt configuration 
loading mechanisms.


   options.sslOptions().sslContextOverride();


--
Tim Bish


-
To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
For additional commands, e-mail: users-h...@qpid.apache.org



ProtonJ2 loading key + trust from a jar

2023-01-27 Thread Segesten, Henrik
Hi

I am using ProtonJ2 as client for connecting to a broker which uses private key 
authentication and a custom trust store. I have managed to accomplish this by 
setting:

options.sslOptions().sslEnabled(true);

options.sslOptions().keyStoreLocation(keyStoreLocation);

options.sslOptions().keyStorePassword(keyStorePassword);

The problem I have is that these two locations are instantiated as java.File 
within ProtonJ2 which means that they need to exist in the file system, and I 
would like to package them within my single spring boot jar. I have not managed 
to accomplish this but have to put the two files next to the jar.

In my experience this could be solved if ProtonJ2 would load the files from a 
Path or URL instead which can reside within the jar.

Looking at the code I think this happens in 
https://github.com/apache/qpid-protonj2/blob/main/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/transport/netty5/SslSupport.java,
 private method loadStore at the end.

I would really appreciate any support in how I can resolve this in some other 
way than changing the code.

Best Regards


Henrik Segesten