diff options
Diffstat (limited to 'tools/decode_token.ps1')
-rw-r--r-- | tools/decode_token.ps1 | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/decode_token.ps1 b/tools/decode_token.ps1 new file mode 100644 index 0000000..9796415 --- /dev/null +++ b/tools/decode_token.ps1 @@ -0,0 +1,20 @@ +# This is a useful diagnostic tool for when users send in failed positive assertions
+# and you want to read what's in the token parameter.
+
+param (
+ $token = { throw "token or urlToken parameter required" },
+ $urlToken
+ )
+
+[void] [Reflection.Assembly]::LoadWithPartialName('System.Web')
+
+if ($urlToken) {
+ $token = [Web.HttpUtility]::UrlDecode($urlToken)
+}
+
+$tokenBytes = [Convert]::FromBase64String($token)
+$siglength = 32
+$decodedToken = [Text.Encoding]::UTF8.GetString($tokenBytes, $siglength, $tokenBytes.length - $siglength)
+
+Write-Host "Decoded token:"
+Write-Host $decodedToken
\ No newline at end of file |