0

I have a data structure that's been imported from a saved JSON file. One of the elements written out is actually a secure string, not a standard string. When read back in with ConvertFrom-Json it shows as a standard string. I can't use it to build a credential as a result.

How do I tell powershell that this data is actually a securestring, without trying to encode it?

1
  • JSON doesn't support securedstring types, I guess you want to convert an encrypted string to a securedstring using ConvertTo-SecuredString. Commented Jan 7, 2020 at 21:05

1 Answer 1

1

Just send the string through ConvertTo-SecureString:

$secureString = 'ENCRYPTED_STRING' | ConvertTo-SecureString

If your original SecureString was created with a specific key, you'll have to provide the -Key or -SecureKey argument in order to construct the SecureString object.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Bender. That different key was the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.