How to decrypt Jenkins passwords

Created: — modified: — tags: jenkins cfengine

with the help of script console

To decrypt a single (very long) {XXX=} string, paste this:

println(hudson.util.Secret.decrypt("{XXX=}"))

To see all stored password, SSH keys, and what else credentials you have, paste this:

com.cloudbees.plugins.credentials.SystemCredentialsProvider.getInstance().getCredentials().forEach{
    it.properties.each { prop, val ->
        if (prop == "secretBytes") {
            println(prop + "=>\n" + new String(com.cloudbees.plugins.credentials.SecretBytes.fromString("${val}").getPlainData()) + "\n")
        } else {
            println(prop + ' = "' + val + '"')
        }
    }
    println("-----------------------")
}

Source: devops