Skip to main content

66 posts tagged with "PowerShell"

PowerShell Scripting and Automation

View All Tags

Fixed: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

I passed one part of a JSON Web Token (JWT) to PowerShell's [Convert]::FromBase64String, and it refused with The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. The part was base64url, which differs from base64 in two ways, and fixing only one of them isn't enough.

How to Generate a Secret Key for HS256 JWTs in the Terminal

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

A JSON Web Token signed with HS256 is only as safe as its secret key. Whoever has the key can make tokens your app will accept. A short or guessable key can be found by testing guesses against any token signed with it, with no need to contact your server. One command gives you a key that's long and random enough.

How to Create an HMAC-SHA256 Signature in the Terminal

· 8 min read
Jagdish Kumawat
Founder @ Dewiride

An HMAC is a signature made with a secret key. Anyone with the same key can make the same signature, and anyone without it can't. HMAC-SHA256 signs JSON Web Tokens that use HS256, and many webhooks use it to prove where a request came from. This guide creates one in the terminal and checks it against the official test value.

How to Send a POST Request to a Web API with curl and PowerShell

· 8 min read
Jagdish Kumawat
Founder @ Dewiride

A POST request sends data to a web API: a new order, a message, a reminder. You don't need a separate tool to send one while you build or test an API. curl does it on macOS and Linux, and PowerShell has Invoke-RestMethod built in. This guide sends the same JSON request both ways, reads the status code, and shows the one header you can't leave out.