0

How to serialize and deserialize powershell PSCredential and SecureString objects? so that these object values can be sent as http Request.

user1174114
  • 178
  • 1
  • 19
  • 1
    Please add more detail and perhaps a [mcve] to your question. Serialization and sending to HTTP requests aren't related on the surface. – briantist Jan 16 '19 at 18:37
  • Sorry for brief question. I just to know that PSCredential cannot be serialized on one machine and deserialized on another, because SecureString is specific to a single machine/user. but looks like Powershell Remoting (PSRP) solves this by using its own encryption to transport SecureString plain text. but I am not sure how is it done. – user1174114 Jan 16 '19 at 19:19
  • The default encryption used during serialization is DPAPI, which is tied to the computer and user, but you can also use your own key to encrypt it and decrypt it (see the `-Key` and `-SecureKey` parameters of `ConvertFrom-` and `ConvertTo-SecureString`). Since PowerShell remoting sessions are encrypted it's possible they use the same symmetric key for that. I'm not sure of the exactly mechanism by which they exchange and handle their shared key. – briantist Jan 16 '19 at 19:24

0 Answers0