4 Replies Latest reply on May 27, 2015 8:13 AM by Carl Ellam-Speed

    Java password encryption

    Carl Ellam-Speed Newbie

      Hi,

       

      I've got Amq installed with a Fuse Camel route listening to a queue and a standalone Java Client that uses JMS to inject messages on the queue. All well and good!

       

      I've enabled encryption of Amq with Jasypt and the can see the password for the admin id is encrypted in my users.properties file (Jaas configuration).

       

      Everything works and I can log in and out of the Admin console etc.

       

      In my Java app, I can only get it to connect using the Plain Text password. If I generate an encrypted password and use it with the JMS connector, I get a:

       

      javax.jms.JMSSecurityException: User name [admin] or password is invalid.

       

      I'm setting up the ActiveMQ producer with:

       

      public ActiveMQ(String uri, String userid, String password, String queue) throws JMSException {
        connectionFactory = new ActiveMQConnectionFactory(uri);
        connection = connectionFactory.createConnection(userid, password);
        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Destination destination = session.createQueue(queue);
        producer = session.createProducer(destination);
        connection.start();
      }
      

       

      What are the steps I need to follow to encrypt the password in the Java file (well, it's props file)?

      Is it possible?

       

      I've generated the jasypt encrypted password and tried passing as:

       

      (ENC)....(ENC)

      ENC(.....)

      (ENC)....

       

      None of these patterns work with the password value. I'm beginning to worry as to whether this is possible; which would be most odd if not.

       

      Thanks and kind regards

       

      Carl