Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Workflow variables are provided from environment variables for shell jobs, see JS7 - Job Instruction.
  • The job decrypts a secret using the current Agent's Private Key.
  • Examples:

    • Code Block
      languagebash
      titleExample for Decryption using Unix Shell
      collapsetrue
      # encrypted result is assumed being available from NEW_VAR environment variable
      secret=$($JS7_AGENT_HOME/bin/js7_decrypt.sh \
          --key=$JS7_AGENT_CONFIG_DIR/private/foobar.key \
          --encrypted-key="$(printf "%s" "$NEW_VAR" | cut -d' ' -f 1)" \
          --iv="$(printf "%s" "$NEW_VAR" | cut -d' ' -f 2)" \
          --in="$(printf "%s" "$NEW_VAR" | cut -d' ' -f 3)")
      echo $secret
    • Code Block
      languagepowershell
      titleExample for Decryption using Windows Shell
      collapsetrue
      @rem encrypted result is assumed being available from NEW_VAR environment variable
      for /f "tokens=1-3" %%i in ("%NEW_VAR%") do (
          set encrypted_symmetric_key=%%i
          set encrypted_base64_iv=%%j
          set encrypted_string=%%k
      )
      
      call "%JS7_AGENT_HOME%\bin\js7_decrypt.cmd" ^
          "--key=%JS7_AGENT_CONFIG_DIR%\private\foobar.key" ^
          "--encrypted-key=%encrypted_symmetric_key%" ^
          "--iv=%encrypted_base64_iv%" ^
          "--in=%encrypted_string%"
      @echo %JS7_DECRYPT_VALUE%
    • Code Block
      languagepowershell
      titleExample for Decryption using PowerShell
      collapsetrue
      # encrypted result is assumed being available from NEW_VAR environment variable
      $secret = Invoke-JS7Decrypt -Value $env:NEW_VAR -KeyPath $JS7$env:JS7_AGENT_CONFIG_DIR/private/foobar.key -JavaLib $JS7$env:JS7_AGENT_HOME/lib
      Write-Output $secret

...

...