0

I am using Jasypt to encrypt and decrypt confidential configuration data in a Java application. Although its easy to use a command line to encrypt a value and replace in configuration file however it is not practical for file containing hundreds of such values and the file is different for different environments and can not be automated.

So what i would like to do is take a non encrypted file and encrypt everything in one go. Using plain java how can i replace value of an configuration data while running through it line by line. Thanks

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
Mark1234
  • 589
  • 2
  • 8
  • 24

1 Answers1

0

Not sure if there is a better way but i was able to use Apache commons io FileUtils. Created a LineIterator and encrypt as you iterate (you need to figure out what need to be encrypted in each line), store the results and finally write everything to a output file. Simple and does what i was looking for.

Mark1234
  • 589
  • 2
  • 8
  • 24