Title: ConvertTo-SecureString truncates to multiples of 8 characters · Issue #16047 · PowerShell/PowerShell · GitHub
Open Graph Title: ConvertTo-SecureString truncates to multiples of 8 characters · Issue #16047 · PowerShell/PowerShell
X Title: ConvertTo-SecureString truncates to multiples of 8 characters · Issue #16047 · PowerShell/PowerShell
Description: PowerShell for every system! Contribute to PowerShell/PowerShell development by creating an account on GitHub.
Open Graph Description: PowerShell for every system! Contribute to PowerShell/PowerShell development by creating an account on GitHub.
X Description: PowerShell for every system! Contribute to PowerShell/PowerShell development by creating an account on GitHub.
Opengraph URL: https://github.com/PowerShell/PowerShell
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ConvertTo-SecureString truncates to multiples of 8 characters","articleBody":"### Prerequisites\n\n- [X] Write a descriptive title.\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\n- [X] Search the existing issues.\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://docs.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\n\n### Steps to reproduce\n\nIn 7.2.0-preview.9, `ConvertTo-SecureString` with either `-Key` or `-SecureKey` truncates the payload down to the nearest multiple of eight characters. `ConvertFrom-SecureString` seems to be fine; SecureStrings created in 7.1.4 and imported to 7.2.0-preview.9 aren't truncated when converted to plaintext.\n\n### Expected behavior\n\n```console\nPS> $Key = [Byte[]]::New(32)\r\n>> '[8Chars][8Chars][Not8]' |\r\n>> ConvertTo-SecureString -AsPlainText -Force |\r\n>> ConvertFrom-SecureString -Key $Key |\r\n>> ConvertTo-SecureString -Key $Key |\r\n>> ConvertFrom-SecureString -AsPlainText\r\n[8Chars][8Chars][Not8]\r\n\r\nPS> $Key = [Byte[]]::New(32)\r\n>> '🟥🟧🟨🟩🟦🟪' |\r\n>> ConvertTo-SecureString -AsPlainText -Force |\r\n>> ConvertFrom-SecureString -Key $Key |\r\n>> ConvertTo-SecureString -Key $Key |\r\n>> ConvertFrom-SecureString -AsPlainText\r\n🟥🟧🟨🟩🟦🟪\n```\n\n\n### Actual behavior\n\n```console\nPS> $Key = [Byte[]]::New(32)\r\n>> '[8Chars][8Chars][Not8]' |\r\n>> ConvertTo-SecureString -AsPlainText -Force |\r\n>> ConvertFrom-SecureString -Key $Key |\r\n>> ConvertTo-SecureString -Key $Key |\r\n>> ConvertFrom-SecureString -AsPlainText\r\n[8Chars][8Chars]\r\n\r\nPS> $Key = [Byte[]]::New(32)\r\n>> '🟥🟧🟨🟩🟦🟪' |\r\n>> ConvertTo-SecureString -AsPlainText -Force |\r\n>> ConvertFrom-SecureString -Key $Key |\r\n>> ConvertTo-SecureString -Key $Key |\r\n>> ConvertFrom-SecureString -AsPlainText\r\n🟥🟧🟨🟩\n```\n\n\n### Error details\n\n_No response_\n\n### Environment data\n\n```powershell\nName Value\r\n---- -----\r\nPSVersion 7.2.0-preview.9\r\nPSEdition Core\r\nGitCommitId 7.2.0-preview.9\r\nOS Microsoft Windows 10.0.22449\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\n```\n\n\n### Visuals\n\n_No response_","author":{"url":"https://github.com/dwtaber","@type":"Person","name":"dwtaber"},"datePublished":"2021-09-04T01:03:55Z","url":"https://github.com/PowerShell/PowerShell/issues/16047"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:3ef58dbd-179b-664b-b923-d98cf0debf90 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D77E:332A98:8BE6C5:C4BC0B:6AFDC769 |
| html-safe-nonce | 8662dff8f8debd90f602acf10ae94dd5408ae7339635b2743d851a00353a4919 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzdFOjMzMkE5ODo4QkU2QzU6QzRCQzBCOjZBRkRDNzY5IiwidmlzaXRvcl9pZCI6Ijc3MzczOTY1NjA2MzUyMTc3NjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0ec747d9aa0dfc04860618a70a39e1e93be9ec6e90a1547746d28e07cf5332fb |
| hovercard-subject-tag | repository:49609581 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/PowerShell/PowerShell/issues/16047 |
| twitter:image | https://repository-images.githubusercontent.com/49609581/aad0ad80-cdec-11ea-8248-a37bc0571bfd |
| twitter:card | summary_large_image |
| og:image | https://repository-images.githubusercontent.com/49609581/aad0ad80-cdec-11ea-8248-a37bc0571bfd |
| og:image:alt | PowerShell for every system! Contribute to PowerShell/PowerShell development by creating an account on GitHub. |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9ab00cc3b4fa90bbd3da70765dd38efc23cfa9d9b0930e41feea2bf67f60ecaf |
| turbo-cache-control | no-cache |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1b795ba060b92691fc16c5a12cf2bf95e83432b4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width