API Key security

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Post Reply
jenkinsta
Posts: 2
Last visit: Mon Apr 19, 2021 3:49 pm

API Key security

Post by jenkinsta »

was reading this https://www.sapien.com/blog/2012/04/30/ ... -packages/
about creds in code.

What I have is an API client and key that I need to secure.

Request-SpecialToken "EXAMPLEID" "EXAMPLEKEY"

Anyway to secure that using the ConvertTo-SecureString?

$c = ConvertTo-SecureString "EXAMPLEID" -AsPlainText -Force

Didnt work

jvierra
Posts: 14776
Last visit: Wed May 05, 2021 1:15 pm
Answers: 9
Has voted: 3 times
Been upvoted: 8 times

Re: API Key security

Post by jvierra »

I thi8nk you want to convert the token and not the ID. A token is usually only good for one session so it cannot be persisted and reused. Check the documentation for teh API to understand how they use tokens and how to use them.

jenkinsta
Posts: 2
Last visit: Mon Apr 19, 2021 3:49 pm

Re: API Key security

Post by jenkinsta »

it all works fine just need to obfuscate the clientid and key from reversing the exe. The module I am calling takes those two and validates then gets the token for later actions.

jvierra
Posts: 14776
Last visit: Wed May 05, 2021 1:15 pm
Answers: 9
Has voted: 3 times
Been upvoted: 8 times

Re: API Key security

Post by jvierra »

So what is not working? You cant use an encrypted string without decrypting it. In an EXE this would happen automatically if the strings are stored inside the code as a global.

Post Reply