-
-
Save tuxfight3r/eca9442ff76649b057ab to your computer and use it in GitHub Desktop.
#To Decrypt Jenkins Password from credentials.xml | |
#<username>jenkins</username> | |
#<passphrase>your-sercret-hash-S0SKVKUuFfUfrY3UhhUC3J</passphrase> | |
#go to the jenkins url | |
http://jenkins-host/script | |
#In the console paste the script | |
hashed_pw='your-sercret-hash-S0SKVKUuFfUfrY3UhhUC3J' | |
passwd = hudson.util.Secret.decrypt(hashed_pw) | |
println(passwd) |
this print null
#In the console paste the script hashed_pw='your-sercret-hash-S0SKVKUuFfUfrY3UhhUC3J' passwd = hudson.util.Secret.decrypt(hashed_pw) println(passwd)
and this print the key
String key = "Vo1hb2DfqHO5U0AdneAmVon1B54VLZr6+2I1AoeONhw=" def secret = hudson.util.Secret.fromString(key) println(secret.getPlainText())
how can I do to devcode password?
@croccio: You need to keep the curly braces
hashed_pw='{Vo1hb2DfqHO5U0AdneAmVon1B54VLZr6+2I1AoeONhw=}'
passwd = hudson.util.Secret.decrypt(hashed_pw)
println(passwd)
# Or
String key = "{Vo1hb2DfqHO5U0AdneAmVon1B54VLZr6+2I1AoeONhw=}"
def secret = hudson.util.Secret.fromString(key)
println(secret.getPlainText())
its not working it can print the string which you have provided good try
You can also find the encrypted key by inspecting the default value in the credentials update form.
How to decrypt credentials stored as a secret file?
@vijayg92 have you find a solution for a secret file stored in credentials.xml ?
remember that this needs the "="
i.e.
if
KEY_PASSWORD=tmdHc/YjAIu1O/XxwnyLTjgHIK1h95JwpskSy23Khj5
then
String key = "tmdHc/YjAIu1O/XxwnyLTjgHIK1h95JwpskSy23Khj5="
def secret = hudson.util.Secret.fromString(key)
println(secret.getPlainText())
Hello, if you don't have acces to the console ... to verify for example the LDAP password that was encrypted ... how do you decrypt the generated password in the config.xml for the LDAP ?
String key = "Vo1hb2DfqHO5U0AdneAmVon1B54VLZr6+2I1AoeONhw="
def secret = hudson.util.Secret.fromString(key)
println(secret.getPlainText())