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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content