jasypt fails to encrypt string with special characters

Solution Verified - Updated -

Issue

If passwords need to be encrypted that contain special characters, escaping those characters may be necessary during input via the CLI. In the following output, the dollar sign is not interpreted correctly and is not included in the "input" string (see Arguments section).

./encrypt.sh input="foo$bar" algorithm=PBEWithMD5AndDES password=mymaster
----ENVIRONMENT-----------------
Runtime: Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.45-b02 
----ARGUMENTS-------------------
algorithm: PBEWithMD5AndDES
input: foo
password: mymaster
----OUTPUT----------------------
vYpHLLjso59xBNNZdWiO6A==

Environment

  • Red Hat A-MQ
    • 6.2.1
  • Red Hat JBoss Fuse
    • 6.2.1
  • Jasypt
    • 1.9.3.redhat_3
  • Linux (tested Fedora 23)

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.