AW: Jasypt Encryption Configuration in Apache Kara

2024-05-15 Thread Karsten Blume
Hi,
we use camel and cfg files for parametrizing the camel and encode the secrets 
in those cfg files.

For this we modify the camel property reader in our camel blueprint inside of 
the camel context:


jasyptRef requested as service being provided for the same blueprint context
  

PropertiesParser provided by another bundle, globally

  
  
  
  
  

  
  

  



  
  

  
  

  

  

  


  



So the decryption depends on different service interfaces, according where you 
need decrypted values.

Hope that helps a bit.
BR
Karsten




Von: Jean-Luc . 
Gesendet: Mittwoch, 15. Mai 2024 09:02
An: user@karaf.apache.org 
Betreff: Jasypt Encryption Configuration in Apache Kara

Hello everyone,
I have recently set up Jasypt encryption with my Apache Karaf 4.4.1 instance. I 
was able to successfully encrypt and retrieve data in my Blueprint XML files 
using the following configuration:
jasypt-encryptor.xml (placed in the deploy folder):





















file:etc/jasypt-mp.properties





This setup allows me to decrypt data in my Blueprint XML files:
ldap-module.xml (also in the deploy folder):






connection.url = ${connection.url}
connection.username= ${ldap.user}
connection.password= ${ldap.password}














This configuration allows me to retrieve my encrypted properties correctly 
(e.g., ldap.password="ENC(encrypted_password)").
However, I am facing difficulties applying the same ENC(...) method in my 
org.ops4j.pax.web.cfg file to decrypt keystore and truststore passwords. It 
appears that I haven't specified anywhere that the decryptor should be used for 
these configurations. I am experiencing a similar issue with my 
org.ops4j.datasource-x.cfg files, which register as datasources in my Apache 
Karaf instance.
I've reviewed the Karaf documentation and other resources but haven't found a 
clear solution to this problem. Does anyone have experience or insights on how 
to resolve this issue? Specifically, how can I configure my setup to use the 
Jasypt decryptor for these .cfg files?
Thank you in advance for your help!
Best regards




AW: Install a feature multiple times with different configurations

2022-12-01 Thread Karsten Blume
Hello Ephemeris,
regarding 2.:
- all the cfg files of format -.cfg will be loaded by the same 
cm; I don't remember the location, but could be directly in the karaf docs.
- pax-jms-config, pax-jdbc-config handle also multiple cfg files (and decanter 
as said before)
BR

-Ursprüngliche Nachricht-
Von: Ephemeris Lappis  
Gesendet: Donnerstag, 1. Dezember 2022 15:05
An: user@karaf.apache.org
Betreff: Re: Install a feature multiple times with different configurations

 Hello.

Well, I've found some examples, and adapting them I have more or less something 
that should work. See my attached blueprint.

Nevertheless, I have some questions about managed service factories.

1) I've tried to use a single CFG file, setting the same persistent ID to 
define two services (my custom one and the XA datasource), but nothing works in 
this case, no error message in the log, and no service is created. Some posts 
seem to confirm that the same ID may be used. Is it wrong ?

2) The pattern for the persistent ID seems to be very strict. It works with 
"my.test.t29.entity" and files like "my.test.t29.entity-.cfg", but I can't 
put "-" or "_" in it... Is there a link to a documentation about these 
conventions ?

3) The only way to initially set the values of the  seems to let the 
container manage them. I've tried with "component-managed", but I found no way 
to have a correct initial state (only works after changing the file and the 
update method is called). This requires setting properties in the file that 
exactly match the attributes/setters of the class. Is it the best/only way to 
do it ?

4) In the datasource case, I've tried to set the OSGi service properties in the 
blueprint, but it seems that the only way to set such properties is putting 
them all in the CFG file, with the exact keys. This way all the properties of 
the file are set as service properties, including the keys that are only needed 
for the component attributes (such as the password that is then exposed in the 
shell or console). Another way to "compose" service properties using selected 
values ?

5) The "managed-properties" or "cm-properties" ignore system properties unlike 
usual properties placeholders. For example in "applicationName=Karaf 
${my.ds.name} - ${env:HOSTNAME}", the inner property "${my.ds.name}" is 
replaced as expected, but the "${env:HOSTNAME}" is not. Another way to get it ?

Thanks in advance for your help.

Regards.

Le mer. 30 nov. 2022 à 17:13, Jean-Baptiste Onofré  a écrit :
>
> You can have managed service factory: one instance per configuration.
>
> It's the way it works in Decanter: you can create multiple 
> elasticsearch collector "attached" to a configuration.
>
> Regards
> JB
>
> On Wed, Nov 30, 2022 at 4:29 PM Ephemeris Lappis 
>  wrote:
> >
> > Hello.
> >
> > Not sure this could work. If all my blueprints and beans/services 
> > objects are defined in the "core feature" bundles, only one instance 
> > of them is created, no ?
> > How could I multiply blueprint containers as many times as I have a 
> > configuration for business entities ?
> >
> > I've already designed my works with a common "core feature" that 
> > pulls the common features (blueprint, transaction, etc.)  and 
> > bundles (beans, database drivers, and so on), and plan to use it 
> > from other features. But I found no way to share blueprints...
> >
> > Thanks for your help.
> >
> > Regards.
> >
> > Le mer. 30 nov. 2022 à 16:00, Matt Pavlovich  a écrit :
> > >
> > > Yes, you would create 1 feature for the jars to provide the functionality 
> > > and then a feature per-configuration. The ‘configuration features’ would 
> > > only contain cfg files (instead of jars) to activate the services with 
> > > different configurations.
> > >
> > > -Matt
> > >
> > > > On Nov 30, 2022, at 6:15 AM, Ephemeris Lappis 
> > > >  wrote:
> > > >
> > > > Hello.
> > > >
> > > > I'm almost sure that my question will seem stupid and perhaps 
> > > > leads to ironic answers...
> > > >
> > > > I'd like to build a feature to define some "templated" services 
> > > > (JDBC data sources for example, or custom services), that should 
> > > > be exactly based on the same definition, but must be 
> > > > instantiated multiple times with distinct configurations. The 
> > > > goal in our global ESB platform is to provide generic Camel 
> > > > routes that will run for an undefined number of business 
> > > > entities. Each entity could be deployed as a feature with its 
> > > > own configuration. Some of the global services use the whiteboard 
> > > > pattern to collect implementations for any number of businesses.
> > > >
> > > > The trivial way could be copying a full project to build as many 
> > > > features as needed, but this is not a very good way to avoid 
> > > > duplicated code and maintain them...
> > > >
> > > > Any ideas on how to do that ?
> > > >
> > > > Thanks a lot.
> > > >
> > > > Regards.
> > >


AW: Exporting an instance of a 3rd party library as service

2022-05-06 Thread Karsten Blume
Hello Geoffrey, Arthur
Thank you for your support regarding this topic. I would like to sum up my 
experience here.

Objective
Is to let client bundles (C) use a preconfigured service of another bundle (S), 
which is implemented by a third bundle or library (I).

In my case this was blueprint bundles
I: the jasypt library as OSGI library, S: my base bundle, C: several camel 
bundles
Service was the org.jasypt.encryption.StringEncryptor interface

Check Manifest files for
S: 
Import-Package: "org.jasypt.encryption" and all implementation packages needed 
to 
Export-Service:  org.jasypt.encryption.StringEncryptor
C: 
Import-Package "org.jasypt.encryption" and 
Import-Service "org.jasypt.encryption.StringEncryptor"
I: 
export all the used packages from above, should be done by implementor or look 
for a servicemix bundle project variant

implementation
all bundles:
maven
use maven-bundle-plugin with *

blueprint
S: 

and instantiate the beans behind the interface (PBE config,...)
C:

and those namespace configuraions you find in the karaf docs

Testing
My default blueprint test context initiates by default a bean, which is 
implementing the StringEncryptor interface. So all references are satisfied.

AND
What happened to me:
Karaf and Camel come with different versions of the jasypt library, ensure that 
you use only one of them for your C bundles. Or in general ensure your I bundle 
is used by S and C at the same time.
Check with the karaf commands 
You have only one version of bundle I (bundle:list or la)
The command "capabilities" shows that your C bundles are connected to the 
correct S bundle.
I achieved that by using the overrides.properties file: 
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jasypt/1.9.2_1;range="[1,2)"
Perhaps you can control this also by the ; parameter in the 
import-package.

Thanks all and I hope the above helps somebody else
Karsten


-Ursprüngliche Nachricht-
Von: Geoffrey Seanor  
Gesendet: Montag, 4. April 2022 18:18
An: user@karaf.apache.org
Betreff: RE: Exporting an instance of a 3rd party library as service

Hi Karsten,

My encryptor service provider 'bundle' is just a blueprint file installed in 
the deploy folder whose singular purpose is to export the service/interface as 
per the various examples online.

The consumer bundle manifest does Import-Package "org.jasypt.encryption" and 
Import-Service "org.jasypt.encryption.StringEncryptor".
It's also ok to use multiple blueprint files in a single bundle.

The error message you provided shows that you don't have a service providing 
the org.jasypt.encryption.StringEncryptor interface.  Can your 'base' bundle 
provide this?

Regards,

Geoff

-Original Message-
From: Karsten Blume  
Sent: 04 April 2022 14:48
To: user@karaf.apache.org
Subject: AW: Exporting an instance of a 3rd party library as service

Hello Geoffrey,
Yes, I mean there are some examples in the WWW on how to use the encryption.

In my "consumer" bundle I have the service reference and the property 
placeholder in different blueprint files, but this should work, at least it 
works for everything else.

Does your base bundle export the jasypt packages or just the service in the 
Meta-Inf file?
And does your consumer bundle import service and package?
BR
Karsten

-Ursprüngliche Nachricht-
Von: Geoffrey Seanor  
Gesendet: Montag, 4. April 2022 13:59
An: user@karaf.apache.org
Betreff: RE: Exporting an instance of a 3rd party library as service

Hi Karsten,

You base bundle looks ok.

My importing blueprint bundle does the following:

1) References this namespace

xmlns:enc="https://apc01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fkaraf.apache.org%2Fxmlns%2Fjasypt%2Fv1.0.0data=04%7C01%7Ckarsten.blume%40ottoint.com%7C2c73b1673c6f448baba508da1656b19b%7Cf73d6f0048944b4eba0071d6df45717d%7C0%7C0%7C637846858899141384%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=bh0oeSilmrdJuyAQLRAlbBBnKKzbPE1MeOkRzxWXqeo%3Dreserved=0;

2) Configures the string encryptor service reference



3) To decrypt values like this


The above works with Karaf 4.2.4 and 4.3.6 running on Linux or Win 7, other 
combinations I'm not sure.
(Note that the service id is local to the blueprint container)

Geoff

-Original Message-
From: Karsten Blume  
Sent: 04 April 2022 11:00
To: user@karaf.apache.org
Subject: AW: Exporting an instance of a 3rd party library as service

Hello Jean-Baptiste, Geoffrey
Here are some more details:

runtime err msg
Unable to start blueprint container for bundle order/22.14.0.98-SNAPSHOT due to 
unresolved dependencies [(objectClass=org.jasypt.encryption.StringEncryptor)]
java.util.concurrent.TimeoutException: null ...
this standard exception stacktrace, when a service was not found

I use the maven bundle plugin without import i

AW: Problems setting up Karaf with ActiveMQ and Blueprint

2022-05-06 Thread Karsten Blume
Hello Heribert,
You need to configure the server AND the client (camel).
It is not sufficient to configure the server only.

Here: 
apache-karaf-4.4.0\examples\karaf-jms-example\karaf-jms-example-command\src\main\java\org\apache\karaf\examples\jms\command\SendCommand.java
Is an example on how to use a AMQ connection factory by hand. The connection 
factory is created by some karaf magic/features and cfg files:
apache-karaf-4.4.0\examples\karaf-jms-example\karaf-jms-example-features\src\main\feature\feature.xml
This creates you the conn factory, you could use/reference it in your camel 
context.

camel-examples\examples\jms-file\src\main\java\org\apache\camel\example\jmstofile\CamelJmsToFileExample.java
Shows how to connect to a JMS server, first by initializing the Camel 
Jms-Component, then the usage in the route.
In blueprint it could be a reference to the connection factory (which was 
created by the feature.xml and cfg file) and with that an initialization of the 
JMS component bean in your blueprint. Then your route is using the component 
(with whatever name you choose).
Bye
Karsten


Von: Steuer Heribert 
Gesendet: Donnerstag, 5. Mai 2022 15:13
An: user@karaf.apache.org
Betreff: AW: Problems setting up Karaf with ActiveMQ and Blueprint

Hello Karsten,

thanks for you reply. The default rollout already provides the file 
${KARAF_BASE}/etc/org.apache.activemq.server-default.cfg which is also mentioned
in the documentation at 
https://activemq.apache.org/osgi-integration.html<https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Factivemq.apache.org%2Fosgi-integration.html=05%7C01%7Ckarsten.blume%40ottoint.com%7C3d59251800e743fd0cf108da2e990a03%7Cf73d6f0048944b4eba0071d6df45717d%7C0%7C0%7C637873532854609662%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=v5EY1%2BcVxWkAfTcrJPJtBUhTG5JRi6rVcoz0rcewnto%3D=0>.
  Also, the activemq.xml file is present in the etc directory and looks okay 
for me (compared to the one in Servicemix).
Both files are default and I did not touch them.

Walking through e.g. 
http://liquid-reality.de/Karaf-Tutorial/05/<https://apc01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fliquid-reality.de%2FKaraf-Tutorial%2F05%2F=05%7C01%7Ckarsten.blume%40ottoint.com%7C3d59251800e743fd0cf108da2e990a03%7Cf73d6f0048944b4eba0071d6df45717d%7C0%7C0%7C637873532854609662%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=LxXWQ3C1U3SKB9pFADsuzhNb3PSDXTB1UjiKG%2BiWto0%3D=0>
 leads to the same issue.

Would be great if you could point me to the right direction ...


Cheers,
Heri



____
Von: Karsten Blume mailto:karsten.bl...@ottoint.com>>
Gesendet: Donnerstag, 5. Mai 2022 12:18
An: user@karaf.apache.org<mailto:user@karaf.apache.org> 
mailto:user@karaf.apache.org>>
Betreff: AW: Problems setting up Karaf with ActiveMQ and Blueprint


Hello Heribert,

You need to use the endpoint or the component parameters to define the broker 
(URL, user, pwd,...).



You could configure the AMQ component as bean including the above parameters, 
then all "activemq" endpoints in your context use this.

Or you define all the parameters in the endpoint URL.

The camel and karaf examples for AMQ should give a direction.

BR

Karsten



Von: Steuer Heribert mailto:ste...@patronas.com>>
Gesendet: Donnerstag, 5. Mai 2022 11:41
An: user@karaf.apache.org<mailto:user@karaf.apache.org>
Betreff: AW: Problems setting up Karaf with ActiveMQ and Blueprint



Hello Erne,



thanks for your answer. I tried that already which leads to the same exception 
(see below), just the endpoint looks a little bit different now.





11:38:38.860 ERROR [Blueprint Event Dispatcher: 1] Error occurred during 
starting CamelContext: camel-6

org.apache.camel.FailedToCreateRouteException: Failed to create route test: 
Route(test)[From[activemq:queue:in] -> [Log[PROCESSED MESSAG... because of 
Failed to resolve endpoint: activemq://queue:in due to: 
java.lang.IllegalArgumentException: wrong number of arguments





Any other ideas?



Cheers,

Heri





Von: Tasi, Erne mailto:e.t...@cenit.com>>
Gesendet: Donnerstag, 5. Mai 2022 11:09
An: user@karaf.apache.org<mailto:user@karaf.apache.org> 
mailto:user@karaf.apache.org>>
Betreff: AW: Problems setting up Karaf with ActiveMQ and Blueprint



Sorry, the correct URL to the Documentation would be ActiveMQ :: Apache 
Camel<https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcamel.apache.org%2Fcomponents%2F3.16.x%2Factivemq-component.html=05%7C01%7Ckarsten.blume%40ottoint.com%7C3d59251800e743fd0cf108da2e990a03%7Cf73d6f0048944b4eba0071d6df45717d%7C0%7C0%7C637873532854609662%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=1oHOvOFEut185UTWKrnGBL0rZ9Rejogdo9fj4wbxOvY%3D=0>.


AW: Problems setting up Karaf with ActiveMQ and Blueprint

2022-05-05 Thread Karsten Blume
Hello Heribert,
You need to use the endpoint or the component parameters to define the broker 
(URL, user, pwd,...).

You could configure the AMQ component as bean including the above parameters, 
then all "activemq" endpoints in your context use this.
Or you define all the parameters in the endpoint URL.
The camel and karaf examples for AMQ should give a direction.
BR
Karsten

Von: Steuer Heribert 
Gesendet: Donnerstag, 5. Mai 2022 11:41
An: user@karaf.apache.org
Betreff: AW: Problems setting up Karaf with ActiveMQ and Blueprint

Hello Erne,

thanks for your answer. I tried that already which leads to the same exception 
(see below), just the endpoint looks a little bit different now.


11:38:38.860 ERROR [Blueprint Event Dispatcher: 1] Error occurred during 
starting CamelContext: camel-6
org.apache.camel.FailedToCreateRouteException: Failed to create route test: 
Route(test)[From[activemq:queue:in] -> [Log[PROCESSED MESSAG... because of 
Failed to resolve endpoint: activemq://queue:in due to: 
java.lang.IllegalArgumentException: wrong number of arguments


Any other ideas?

Cheers,
Heri


Von: Tasi, Erne mailto:e.t...@cenit.com>>
Gesendet: Donnerstag, 5. Mai 2022 11:09
An: user@karaf.apache.org 
mailto:user@karaf.apache.org>>
Betreff: AW: Problems setting up Karaf with ActiveMQ and Blueprint


Sorry, the correct URL to the Documentation would be ActiveMQ :: Apache 
Camel.

At first I could not send the previous mail and afterwards something went wrong 
as I copy-pasted my original answer.



Cheers,

Erne



Von: Tasi, Erne
Gesendet: Donnerstag, 5. Mai 2022 10:42
An: user@karaf.apache.org
Betreff: AW: Problems setting up Karaf with ActiveMQ and Blueprint



Hi Heri,



As the Exception states you did not provide all the needed arguments in you=  
from and to statements.

According to the documentation ActiveMQ :: Apache Camel>
 your Route would have to look something like this:



  







  



Best Regards,

Erne





Von: Steuer Heribert [mailto:ste...@patronas.com]
Gesendet: Donnerstag, 5. Mai 2022 09:57
An: user@karaf.apache.org
Betreff: Problems setting up Karaf with ActiveMQ and Blueprint



Hello,



we are currently trying to upgrade a couple of old Apache Servicemix 
installations which came pre-bundled with Karaf, ActiveMQ, Camel and Blueprint 
support. As it seems that Servicemix is no

longer maintained, I would like to set up a similar instance with Karaf and the 
appropriate bundles.



Setup: Karaf 4.3.7 running on openjdk version "17.0.1" 2021-10-19



On a freshly unpacked Karaf instance, I execute the following commands:



feature:repo-add activemq 5.16.4

feature:repo-add camel 3.16.0

feature:repo-refresh



feature:install activemq-broker

feature:install camel-jms

feature:install camel-blueprint



Running a simple blueprint route (route attached below) that reads from a queue 
and writes to another queue fails with:



2022-05-05T09:41:46,026 | ERROR | Blueprint Event Dispatcher: 1 | 
BlueprintCamelContext| 213 - org.apache.camel.karaf.camel-blueprint 
- 3.16.0 | Error occurred during starting CamelContext: camel-1

org.apache.camel.FailedToCreateRouteException: Failed to create route test: 
Route(test)[From[activemq://in] -> [Log[PROCESSED MESSAGE],... because of 
Failed to resolve endpoint: activemq://in due to: 
java.lang.IllegalArgumentException: wrong number of arguments



I found some issues on the web related to that exception but all points refer 
to packages that I do not use (activemq-camel). I have attached the full stack 
trace below for completeness. I am pretty sure that this just

happens because of lack of knowledge, but I did not find a path out of that 
problem. So hopefully one of you can point me to the right direction.



Cheers,

Heri





org.apache.camel.FailedToCreateRouteException: Failed to create route test: 
Route(test)[From[activemq://in] -> [Log[PROCESSED MESSAGE],... because of 
Failed to resolve endpoint: activemq://in due to: 
java.lang.IllegalArgumentException: wrong number of arguments

at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:80) 
~[!/:3.16.0]

at 
org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49)
 ~[!/:3.16.0]

at 

AW: Exporting an instance of a 3rd party library as service

2022-04-06 Thread Karsten Blume
Hello Arthur,
I have added the servicemix version of jasypt

org.apache.servicemix.bundles
org.apache.servicemix.bundles.jasypt
1.9.2_1
provided

and excluded the original jasypt from camel-jasypt dep, so any bundle is using 
the above OSGI version.
I defined this in the parent pom with "provided" scope for all modules.
So I assume that all bundles have the servicemix jasypt in their classpath.

I should expect the package "org.jasypt.encryption " in the import section of 
the Meta-Inf and in service-import section 
"org.jasypt.encryption.StringEncryptor"?

BR
Karsten

Von: Arthur Naseef 
Gesendet: Montag, 4. April 2022 18:58
An: user@karaf.apache.org
Betreff: Re: Exporting an instance of a 3rd party library as service

The following error message says the importing bundle (order) does not have 
access to the class "org.jasypt.encryption.StringEncryptor".

Unable to start blueprint container for bundle order/22.14.0.98-SNAPSHOT due to 
unresolved dependencies [(objectClass=org.jasypt.encryption.StringEncryptor)]

In order to use a "reference" with an interface class, the bundle needs to have 
that interface class on its own classpath.  Is the module with that class in 
the list of dependencies for the bundle (the one using "reference)?

Art

On Mon, Apr 4, 2022 at 3:00 AM Karsten Blume 
mailto:karsten.bl...@ottoint.com>> wrote:
Hello Jean-Baptiste, Geoffrey
Here are some more details:

runtime err msg
Unable to start blueprint container for bundle order/22.14.0.98-SNAPSHOT due to 
unresolved dependencies [(objectClass=org.jasypt.encryption.StringEncryptor)]
java.util.concurrent.TimeoutException: null
...
this standard exception stacktrace, when a service was not found

I use the maven bundle plugin without import instruction, so it uses * as 
default.
The Meta-Inf shows the service/interface listed in the export- and 
import-service sections properly. In karaf cmd line with bundle:requirements 
and bundle:capabilites both could be seen.

@Geoffry
exactly this I want to achieve, yes.
Base bundle:
...





Importing Bundle:
   


One thing I need to add: Running on Windows 10 the pax-jdbc v0.9 is able to 
find the service, on WSL2 Ubuntu, Docker jre8-alpine or Mac the service is not 
found.

Question: In general, a base bundle should be able to instantiate a class of 
another library and offer this as a service?
Does this base bundle should export the packages of this other library? Ie. for 
Jasypt lib org.jasypt.encryption and sub-packages?

Regards
Karsten

Ursprüngliche Nachricht-
Von: Geoffrey Seanor 
mailto:geoffrey.sea...@mufgsecurities.com>>
Gesendet: Montag, 4. April 2022 10:23
An: user@karaf.apache.org<mailto:user@karaf.apache.org>
Betreff: RE: Exporting an instance of a 3rd party library as service

Hi Karsten,

Have you tried exporting interface org.jasypt.encryption.StringEncryptor?

I export this interface using a dedicated blueprint bundle and pass it the 
decryption password from the environment.  This service is then used by 
pax-jdbc, and also referenced by other blueprint bundles which need to import 
the jasypt namespace and use a property-placeholder to resolve the encrypted 
entries.

Kind regards,

Geoff

-Original Message-
From: Jean-Baptiste Onofré mailto:j...@nanthrax.net>>
Sent: 04 April 2022 08:49
To: user@karaf.apache.org<mailto:user@karaf.apache.org>
Subject: Re: Exporting an instance of a 3rd party library as service

*** External email: Please be cautious when opening attachments or clicking 
links. ***


Hi,

What do you mean by "not finding the service" ?
You mean at runtime (looking for service reference) or at deployment time (the 
maven-bundle-plugin is generated req/cap for service, so it might be your 
issue) ?

If you can share the message you have, it would be helpful.

Regards
JB

On Mon, Apr 4, 2022 at 9:06 AM Karsten Blume 
mailto:karsten.bl...@ottoint.com>> wrote:
>
> Hello everybody,
>
> i come up with a issue, which might be easily answered in the OSGI world, 
> though I have not yet found a solution in the WWW.
>
>
>
> Running
>
> Karaf 3.0.7, Java8, Blueprint
>
>
>
> Objective
>
> Any bundle (own or e.g. pax-jdbc-config) should be able to use the same 
> configured StringEncryptor.
>
>
>
> How
>
> I configure and create an instance of 
> org.jasypt.encryption.pbe.StandardPBEStringEncryptor  and export this 
> instance as a service of interface org.jasypt.encryption.StringEncryption. in 
> one of my base bundles.
>
> All other bundles reference the interface to get the service.
>
>
>
> Problem
>
> If I export the original interface as service the others are not  finding 
> this service (having modified the Maven bundle plugin properly).
>

AW: Exporting an instance of a 3rd party library as service

2022-04-04 Thread Karsten Blume
Hello Geoffrey,
Yes, I mean there are some examples in the WWW on how to use the encryption.

In my "consumer" bundle I have the service reference and the property 
placeholder in different blueprint files, but this should work, at least it 
works for everything else.

Does your base bundle export the jasypt packages or just the service in the 
Meta-Inf file?
And does your consumer bundle import service and package?
BR
Karsten

-Ursprüngliche Nachricht-
Von: Geoffrey Seanor  
Gesendet: Montag, 4. April 2022 13:59
An: user@karaf.apache.org
Betreff: RE: Exporting an instance of a 3rd party library as service

Hi Karsten,

You base bundle looks ok.

My importing blueprint bundle does the following:

1) References this namespace

xmlns:enc="https://apc01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fkaraf.apache.org%2Fxmlns%2Fjasypt%2Fv1.0.0data=04%7C01%7Ckarsten.blume%40ottoint.com%7C70ffc6aaf4184a5ee7cf08da1632aad6%7Cf73d6f0048944b4eba0071d6df45717d%7C0%7C0%7C637846704160479432%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=b9kcWUMdlSqYxD9OgG5Sr%2BwD8u0Q2Am2GMzt08UJ2g8%3Dreserved=0;

2) Configures the string encryptor service reference



3) To decrypt values like this


The above works with Karaf 4.2.4 and 4.3.6 running on Linux or Win 7, other 
combinations I'm not sure.
(Note that the service id is local to the blueprint container)

Geoff

-Original Message-
From: Karsten Blume  
Sent: 04 April 2022 11:00
To: user@karaf.apache.org
Subject: AW: Exporting an instance of a 3rd party library as service

Hello Jean-Baptiste, Geoffrey
Here are some more details:

runtime err msg
Unable to start blueprint container for bundle order/22.14.0.98-SNAPSHOT due to 
unresolved dependencies [(objectClass=org.jasypt.encryption.StringEncryptor)]
java.util.concurrent.TimeoutException: null ...
this standard exception stacktrace, when a service was not found

I use the maven bundle plugin without import instruction, so it uses * as 
default.
The Meta-Inf shows the service/interface listed in the export- and 
import-service sections properly. In karaf cmd line with bundle:requirements 
and bundle:capabilites both could be seen.

@Geoffry
exactly this I want to achieve, yes.
Base bundle:
...

  

Importing Bundle:
   


One thing I need to add: Running on Windows 10 the pax-jdbc v0.9 is able to 
find the service, on WSL2 Ubuntu, Docker jre8-alpine or Mac the service is not 
found.

Question: In general, a base bundle should be able to instantiate a class of 
another library and offer this as a service? 
Does this base bundle should export the packages of this other library? Ie. for 
Jasypt lib org.jasypt.encryption and sub-packages?

Regards
Karsten

Ursprüngliche Nachricht-
Von: Geoffrey Seanor 
Gesendet: Montag, 4. April 2022 10:23
An: user@karaf.apache.org
Betreff: RE: Exporting an instance of a 3rd party library as service

Hi Karsten,

Have you tried exporting interface org.jasypt.encryption.StringEncryptor?

I export this interface using a dedicated blueprint bundle and pass it the 
decryption password from the environment.  This service is then used by 
pax-jdbc, and also referenced by other blueprint bundles which need to import 
the jasypt namespace and use a property-placeholder to resolve the encrypted 
entries.

Kind regards,

Geoff

-Original Message-
From: Jean-Baptiste Onofré 
Sent: 04 April 2022 08:49
To: user@karaf.apache.org
Subject: Re: Exporting an instance of a 3rd party library as service

*** External email: Please be cautious when opening attachments or clicking 
links. ***


Hi,

What do you mean by "not finding the service" ?
You mean at runtime (looking for service reference) or at deployment time (the 
maven-bundle-plugin is generated req/cap for service, so it might be your 
issue) ?

If you can share the message you have, it would be helpful.

Regards
JB

On Mon, Apr 4, 2022 at 9:06 AM Karsten Blume  wrote:
>
> Hello everybody,
>
> i come up with a issue, which might be easily answered in the OSGI world, 
> though I have not yet found a solution in the WWW.
>
>
>
> Running
>
> Karaf 3.0.7, Java8, Blueprint
>
>
>
> Objective
>
> Any bundle (own or e.g. pax-jdbc-config) should be able to use the same 
> configured StringEncryptor.
>
>
>
> How
>
> I configure and create an instance of 
> org.jasypt.encryption.pbe.StandardPBEStringEncryptor  and export this 
> instance as a service of interface org.jasypt.encryption.StringEncryption. in 
> one of my base bundles.
>
> All other bundles reference the interface to get the service.
>
>
>
> Problem
>
> If I export the original interface as service the others are not  finding 
> this service (having modified the Maven bundle plugin properly).
>
> Do I need to wrap the StringEncry

AW: Exporting an instance of a 3rd party library as service

2022-04-04 Thread Karsten Blume
Hello Jean-Baptiste, Geoffrey
Here are some more details:

runtime err msg 
Unable to start blueprint container for bundle order/22.14.0.98-SNAPSHOT due to 
unresolved dependencies [(objectClass=org.jasypt.encryption.StringEncryptor)]
java.util.concurrent.TimeoutException: null
...
this standard exception stacktrace, when a service was not found

I use the maven bundle plugin without import instruction, so it uses * as 
default.
The Meta-Inf shows the service/interface listed in the export- and 
import-service sections properly. In karaf cmd line with bundle:requirements 
and bundle:capabilites both could be seen.

@Geoffry
exactly this I want to achieve, yes.
Base bundle:
...





Importing Bundle:
   


One thing I need to add: Running on Windows 10 the pax-jdbc v0.9 is able to 
find the service, on WSL2 Ubuntu, Docker jre8-alpine or Mac the service is not 
found.

Question: In general, a base bundle should be able to instantiate a class of 
another library and offer this as a service? 
Does this base bundle should export the packages of this other library? Ie. for 
Jasypt lib org.jasypt.encryption and sub-packages?

Regards
Karsten

Ursprüngliche Nachricht-
Von: Geoffrey Seanor  
Gesendet: Montag, 4. April 2022 10:23
An: user@karaf.apache.org
Betreff: RE: Exporting an instance of a 3rd party library as service

Hi Karsten,

Have you tried exporting interface org.jasypt.encryption.StringEncryptor?

I export this interface using a dedicated blueprint bundle and pass it the 
decryption password from the environment.  This service is then used by 
pax-jdbc, and also referenced by other blueprint bundles which need to import 
the jasypt namespace and use a property-placeholder to resolve the encrypted 
entries.

Kind regards,

Geoff

-Original Message-
From: Jean-Baptiste Onofré  
Sent: 04 April 2022 08:49
To: user@karaf.apache.org
Subject: Re: Exporting an instance of a 3rd party library as service

*** External email: Please be cautious when opening attachments or clicking 
links. ***


Hi,

What do you mean by "not finding the service" ?
You mean at runtime (looking for service reference) or at deployment time (the 
maven-bundle-plugin is generated req/cap for service, so it might be your 
issue) ?

If you can share the message you have, it would be helpful.

Regards
JB

On Mon, Apr 4, 2022 at 9:06 AM Karsten Blume  wrote:
>
> Hello everybody,
>
> i come up with a issue, which might be easily answered in the OSGI world, 
> though I have not yet found a solution in the WWW.
>
>
>
> Running
>
> Karaf 3.0.7, Java8, Blueprint
>
>
>
> Objective
>
> Any bundle (own or e.g. pax-jdbc-config) should be able to use the same 
> configured StringEncryptor.
>
>
>
> How
>
> I configure and create an instance of 
> org.jasypt.encryption.pbe.StandardPBEStringEncryptor  and export this 
> instance as a service of interface org.jasypt.encryption.StringEncryption. in 
> one of my base bundles.
>
> All other bundles reference the interface to get the service.
>
>
>
> Problem
>
> If I export the original interface as service the others are not  finding 
> this service (having modified the Maven bundle plugin properly).
>
> Do I need to wrap the StringEncryptor in a delegate pattern, so I export my 
> own interface?
>
>
>
> Any help is appreciated,
>
> Thx Karsten
>
>

This email including any attachments is confidential and may be subject to 
legal privilege. Unless otherwise indicated, you may not disclose or distribute 
this email to any other person.  If you are not the intended recipient of this 
email, please delete it and notify the sender immediately. 

MUFG Bank, Ltd. ("MUFG Bank"), MUFG Securities EMEA plc ("MUS(EMEA)") and 
Mitsubishi UFJ Financial Group, Inc. ("MUFG Inc.") are members of the MUFG 
group.

-   MUFG Bank is a limited liability stock company incorporated in Japan 
and registered in the Tokyo Legal Affairs Bureau (company no. 0100-01-008846). 
MUFG Bank's head office is at 7-1 Marunouchi 2-Chome, Chiyoda-Ku, Tokyo 
100-8388, Japan. MUFG Bank's London branch is at Ropemaker Place, 25 Ropemaker 
Street, London EC2Y 9AN, and is registered as a UK establishment in the UK 
register of companies (registered no. BR002013).   MUFG Bank is authorised and 
regulated by the Japanese Financial Services Agency. MUFG Bank's London branch 
is authorised by the UK Prudential Regulation Authority ("PRA") and regulated 
by the UK Financial Conduct Authority ("FCA") with limited regulation by the 
PRA.
-   MUS(EMEA) is a limited liability company registered in England (company 
no. 1698498) with its registered office at Ropemaker Place, 25 Ropemaker 
Street, London, EC2Y 9AJ.  MUS (EMEA) is authorised by the PRA and regulated by 
the FCA and PRA in the UK.
-   MUFG Inc. is 

Exporting an instance of a 3rd party library as service

2022-04-04 Thread Karsten Blume
Hello everybody,
i come up with a issue, which might be easily answered in the OSGI world, 
though I have not yet found a solution in the WWW.

Running
Karaf 3.0.7, Java8, Blueprint

Objective
Any bundle (own or e.g. pax-jdbc-config) should be able to use the same 
configured StringEncryptor.

How
I configure and create an instance of 
org.jasypt.encryption.pbe.StandardPBEStringEncryptor  and export this instance 
as a service of interface org.jasypt.encryption.StringEncryption. in one of my 
base bundles.
All other bundles reference the interface to get the service.

Problem
If I export the original interface as service the others are not  finding this 
service (having modified the Maven bundle plugin properly).
Do I need to wrap the StringEncryptor in a delegate pattern, so I export my own 
interface?

Any help is appreciated,
Thx Karsten