Skip to content

Instantly share code, notes, and snippets.

@rubberduck203
Created August 8, 2018 01:29
Show Gist options
  • Select an option

  • Save rubberduck203/604822a166249d761b0c28d0cceefc5b to your computer and use it in GitHub Desktop.

Select an option

Save rubberduck203/604822a166249d761b0c28d0cceefc5b to your computer and use it in GitHub Desktop.

Revisions

  1. rubberduck203 created this gist Aug 8, 2018.
    10 changes: 10 additions & 0 deletions decrypt.groovy
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    // Run in the Jenkins script console
    // https://stackoverflow.com/questions/37683143/extract-passphrase-from-jenkins-credentials-xml

    // file containing value without surrounding curly braces
    File file = new File("/path/to/file.txt")
    hudson.util.Secret.decrypt("{${file.text}}")

    // file with value including curly braces
    File file = new File("/path/to/file.txt")
    hudson.util.Secret.decrypt(file.text)