win_credential - fix encoding for text based secrets (#54695)

* win_credential - fix encoding for text based secrets

* Fix py2 encoding issues
This commit is contained in:
Jordan Borean
2019-04-02 09:29:05 +10:00
committed by GitHub
parent 95e5f89089
commit c40f41d519
3 changed files with 9 additions and 4 deletions

View File

@@ -555,7 +555,7 @@ if ($null -ne $secret) {
if ($secret_format -eq "base64") {
$secret = [System.Convert]::FromBase64String($secret)
} else {
$secret = [System.Text.Encoding]::UTF8.GetBytes($secret)
$secret = [System.Text.Encoding]::Unicode.GetBytes($secret)
}
}

View File

@@ -45,7 +45,8 @@ options:
data_format:
description:
- Controls the input type for I(data).
- If C(text), I(data) is a text string that is UTF-8 encoded to bytes.
- If C(text), I(data) is a text string that is UTF-16LE encoded to
bytes.
- If C(base64), I(data) is a base64 string that is base64 decoded to
bytes.
type: str
@@ -88,7 +89,7 @@ options:
secret_format:
description:
- Controls the input type for I(secret).
- If C(text), I(secret) is a text string that is UTF-8 encoded to bytes.
- If C(text), I(secret) is a text string that is UTF-16LE encoded to bytes.
- If C(base64), I(secret) is a base64 string that is base64 decoded to
bytes.
type: str