You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by "Segesten, Henrik" <he...@volvocars.com.INVALID> on 2023/01/27 14:18:35 UTC

ProtonJ2 loading key + trust from a jar

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



Re: ProtonJ2 loading key + trust from a jar

Posted by Timothy Bish <ta...@gmail.com>.
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(<your-context>);


-- 
Tim Bish


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