2

I am using grails Jasypt Encryption plugin to encrypt my data in the DB.

If I set jasypt configurations in my Config.groovy file like:

jasypt {
    algorithm = "PBEWITHSHA256AND256BITAES-CBC-BC"
    providerName = "BC"
    password = "myPassphrase"
    keyObtentionIterations = 1000
}

then everything is working fine.

But if I move the jasypt configurations in an external file as mentioned in the jasypt doc(External Config Files in Grails) then these configuration are not being accessed.

How to access jsypt external configuration file?

Note:- Using ubuntu

MKB
  • 7,587
  • 9
  • 45
  • 71
  • Could you show the part from your Config.groovy where you configure your external jasypt-configuration? – piet.t Dec 04 '13 at 07:24
  • I am following this link (https://bitbucket.org/tednaleid/grails-jasypt/wiki/Home see the section:- External Config Files in Grails). I have never read external config file so I am not sure that I am doing it right way. – MKB Dec 04 '13 at 07:29

2 Answers2

2

Since your Jasypt config block uses ConfigSlurper syntax, your external config file needs a .groovy extension (e.g. .jasypt.groovy) Or, you could switch to Java .properties syntax.

Andrew
  • 2,239
  • 13
  • 7
  • Thanks Andrew, `.jasypt.groovy` works fine. Following is my working configurations `"file:${System.getenv('ENCRYPTION_CONFIG_LOCATION')}" ?: "file:${userHome}/.jasypt.groovy"`, working fine for System variable as well. THANKS..,. – MKB Dec 05 '13 at 14:42
0

If you just copy-pasted this section:

def configFIlePath = System.getenv('ENCRYPTION_CONFIG_LOCATION') ?: "file:${userHome}/.jasypt"
grails.config.locations = [configFilePath]

pay special attention to the typo: in the first line it must be configFilePath with a lower-case i!!

piet.t
  • 11,718
  • 21
  • 43
  • 52
  • Still it is not reading the config file. It is not showing me the saved values in the DB. If you want I can give you my sample project. – MKB Dec 04 '13 at 07:53