TeamFair / meokQ-backend

springboot application project of meokQ service.
1 stars 0 forks source link

[feat] encryption sensitive_value #15

Open youngyin opened 9 months ago

youngyin commented 9 months ago

encryption sensitive_value

  1. dependency
    implementation 'org.jasypt:jasypt-spring-boot-starter' 
  2. encrypt sensitive_value
    java -cp jasypt-3.0.4.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="your_sensitive_value" password=mySecretKey algorithm=PBEWithMD5AndDES
  3. decrypt
    
    import org.jasypt.encryption.pbe.StandardPBEStringEncryptor
    import org.springframework.beans.factory.annotation.Value
    import org.springframework.stereotype.Service

@Service class MyService(private val encryptor: StandardPBEStringEncryptor) {

@Value("\${my.secret.encrypted.property}")
private lateinit var encryptedProperty: String

fun getDecryptedProperty(): String {
    return encryptor.decrypt(encryptedProperty)
}

}

youngyin commented 7 months ago

[참고]