javaspringencryptionjvmjasypt

gradle using vm option jasypt private key is not working


I want to use db password with jasypt.

first, in application.yml, it is working writing jasypt.encryptor.password=myencrypt.

but I want use vm option. so I use $ ./gradlew -Djasypt.encryptor.password=myencrypt bootRun

but it makes Failed to bind preperties under spring.datasources.password to java.lang.string: Reason: either 'jasypt.encryptor.password' or one of ['jasypt.encryptor.privatr-key-string', 'jasypt.encrytor.private-key-location'] must be provided for password-based or Asymmetric encryption

jasypt version 2.1.2 and 3.0.4 are same error type. jdk 1.8


Solution

  • use

    -Pjasypt.encryptor.password=myencrypt
    

    in build.gradle

    bootRun {
        systemProperty "jasypt.encryptor.password", findProperty("jasypt.encryptor.password")
    }
    

    with jasypt 2.1.2.

    above 3.0.0, need something like jasypt.encryptor.iv-generator-classname because algorithm change