You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Onder SEZGIN <on...@gmail.com> on 2018/10/09 08:55:47 UTC

SSLContextParameters value injection with a static method invocation

Hi,

I have sslContextParameters as below as an example.

    <camel:sslContextParameters
      id="sslContextParameters">
    <camel:keyManagers
        keyPassword="{{ssl.keymanager.pass}}">
      <camel:keyStore
          resource="C:\\Program
Files\\Java\\jdk1.8.0_161\\jre\\lib\\security\\cacerts"
          password="{{ssl.keystore.pass}}"/>
    </camel:keyManagers>
  </camel:sslContextParameters>

and i have the requirement that those {{ssl.keymanager.pass}} and
{{ssl.keystore.pass}} values which are stored in an encrypted format.
And i want to decrypt them and then inject their values to password
attributes in this xml definition.

I have a single method which i can find out the decrypted value, but not
sure how i can inject.
I think only properties components with {{ is supported whereas SPEL is not.

I tried like this;

<camel:sslContextParameters
      id="sslContextParameters">
    <camel:keyManagers
        keyPassword="#{ T(MY_PACKAGE).decrypt('${ssl.keystore.pass}')}">
      <camel:keyStore
          resource="C:\\Program
Files\\Java\\jdk1.8.0_161\\jre\\lib\\security\\cacerts"
          password="#{ T(MY_PACKAGE).decrypt('${ssl.keystore.pass}')}"/>
    </camel:keyManagers>
  </camel:sslContextParameters>

Is there any other way i can inject?

Thanks.

Re: SSLContextParameters value injection with a static method invocation

Posted by Onder SEZGIN <on...@gmail.com>.
Okay, using

<bean id="sslContextParameters"
class="org.apache.camel.util.jsse.SSLContextParameters">

and injecting camelContext to it helped me.
Thanks.

On Tue, Oct 9, 2018 at 11:55 AM Onder SEZGIN <on...@gmail.com> wrote:

> Hi,
>
> I have sslContextParameters as below as an example.
>
>     <camel:sslContextParameters
>       id="sslContextParameters">
>     <camel:keyManagers
>         keyPassword="{{ssl.keymanager.pass}}">
>       <camel:keyStore
>           resource="C:\\Program
> Files\\Java\\jdk1.8.0_161\\jre\\lib\\security\\cacerts"
>           password="{{ssl.keystore.pass}}"/>
>     </camel:keyManagers>
>   </camel:sslContextParameters>
>
> and i have the requirement that those {{ssl.keymanager.pass}} and
> {{ssl.keystore.pass}} values which are stored in an encrypted format.
> And i want to decrypt them and then inject their values to password
> attributes in this xml definition.
>
> I have a single method which i can find out the decrypted value, but not
> sure how i can inject.
> I think only properties components with {{ is supported whereas SPEL is
> not.
>
> I tried like this;
>
> <camel:sslContextParameters
>       id="sslContextParameters">
>     <camel:keyManagers
>         keyPassword="#{ T(MY_PACKAGE).decrypt('${ssl.keystore.pass}')}">
>       <camel:keyStore
>           resource="C:\\Program
> Files\\Java\\jdk1.8.0_161\\jre\\lib\\security\\cacerts"
>           password="#{ T(MY_PACKAGE).decrypt('${ssl.keystore.pass}')}"/>
>     </camel:keyManagers>
>   </camel:sslContextParameters>
>
> Is there any other way i can inject?
>
> Thanks.
>
>
>