對這個問題Is it possible to use the Grails Jasypt plugin outside the GORM layer for simple String encryption and decryption?Jasypt插件在Grails的
我試圖實現它爲我的密碼加密/解密的參考加密/解密。 但每次它給同一密碼不同的加密值。所以我如何使用下面的代碼和jasypt配置?
def authenticate(){
def jasyptConfig = grailsApplication.config.jasypt
org.jasypt.encryption.pbe.StandardPBEStringEncryptor stringEncryptor =
new org.jasypt.encryption.pbe.StandardPBEStringEncryptor(jasyptConfig)
def encrypted = stringEncryptor.encrypt(params.password)
}
jasypt {
algorithm = "PBEWITHSHA256AND256BITAES-CBC-BC"
providerName = "BC"
password = "test"
keyObtentionIterations = 1000
}
發佈您的jasypt配置。有可能你使用的隨機鹽總是會導致不同的值。 –
這是我jasypt配置: jasypt { 算法= 「PBEWITHSHA256AND256BITAES-CBC-BC」 的providerName = 「BC」 密碼= 「測試」 keyObtentionIterations = 1000 } – Britman
喜jashua摩爾,如何配置這一點沒有亂? ! – Britman