Skip to content

Commit

Permalink
Fix #4231 - Correct digit and other markdown cleanup (#4232)
Browse files Browse the repository at this point in the history
  • Loading branch information
DCtheGeek authored and sdwheeler committed Apr 27, 2019
1 parent 2114f57 commit f03173f
Show file tree
Hide file tree
Showing 5 changed files with 297 additions and 216 deletions.
Original file line number Diff line number Diff line change
@@ -1,73 +1,89 @@
---
ms.date: 06/09/2017
schema: 2.0.0
locale: en-us
keywords: powershell,cmdlet
online version: http://go.microsoft.com/fwlink/?LinkID=113287
external help file: Microsoft.PowerShell.Security.dll-Help.xml
title: ConvertFrom-SecureString
ms.date: 04/27/2019
schema: 2.0.0
locale: en-us
keywords: powershell,cmdlet
online version: http://go.microsoft.com/fwlink/?LinkID=113287
external help file: Microsoft.PowerShell.Security.dll-Help.xml
title: ConvertFrom-SecureString
---

# ConvertFrom-SecureString

## SYNOPSIS
Converts a secure string into an encrypted standard string.

## SYNTAX

### Secure (Default)

```
ConvertFrom-SecureString [-SecureString] <SecureString> [[-SecureKey] <SecureString>] [<CommonParameters>]
```

### Open

```
ConvertFrom-SecureString [-SecureString] <SecureString> [-Key <Byte[]>] [<CommonParameters>]
```

## DESCRIPTION
The **ConvertFrom-SecureString** cmdlet converts a secure string (System.Security.SecureString) into an encrypted standard string (System.String).
Unlike a secure string, an encrypted standard string can be saved in a file for later use.
The encrypted standard string can be converted back to its secure string format by using the ConvertTo-SecureString cmdlet.

If an encryption key is specified by using the **Key** or **SecureKey** parameters, the Advanced Encryption Standard (AES) encryption algorithm is used.
The specified key must have a length of 128, 192, or 256 bits because those are the key lengths supported by the AES encryption algorithm.
If no key is specified, the Windows Data Protection API (DPAPI) is used to encrypt the standard string representation.
The **ConvertFrom-SecureString** cmdlet converts a secure string (**System.Security.SecureString**)
into an encrypted standard string (**System.String**). Unlike a secure string, an encrypted standard
string can be saved in a file for later use. The encrypted standard string can be converted back to
its secure string format by using the `ConvertTo-SecureString` cmdlet.

If an encryption key is specified by using the **Key** or **SecureKey** parameters, the Advanced
Encryption Standard (AES) encryption algorithm is used. The specified key must have a length of 128,
192, or 256 bits because those are the key lengths supported by the AES encryption algorithm. If no
key is specified, the Windows Data Protection API (DPAPI) is used to encrypt the standard string
representation.

## EXAMPLES

### Example 1
```
PS C:\> $SecureString = Read-Host -AsSecureString
```
### Example 1: Create a secure string

This command creates a secure string from characters that you type at the command prompt.
After entering the command, type the string you want to store as a secure string.
An asterisk (*) is displayed to represent each character that you type.
### Example 2
```
PS C:\> $StandardString = ConvertFrom-SecureString $SecureString
```powershell
$SecureString = Read-Host -AsSecureString
```

This command converts the secure string in the $SecureString variable to an encrypted standard string.
The resulting encrypted standard string is stored in the $StandardString variable.
### Example 3
This command creates a secure string from characters that you type at the command prompt. After
entering the command, type the string you want to store as a secure string. An asterisk (`*`) is
displayed to represent each character that you type.

### Example 2: Convert a secure string to an encrypted standard string

```powershell
$StandardString = ConvertFrom-SecureString $SecureString
```
PS C:\> $Key = (3,4,2,3,56,34,254,222,1,1,2,23,42,54,33,233,1,34,2,7,6,5,35,43)
PS C:\> $StandardString = ConvertFrom-SecureString $SecureString -Key $Key

This command converts the secure string in the `$SecureString` variable to an encrypted standard
string. The resulting encrypted standard string is stored in the `$StandardString` variable.

### Example 3: Convert a secure string to an encrypted standard string with a 192-bit key

```powershell
$Key = (3,4,2,3,56,34,254,222,1,1,2,23,42,54,33,233,1,34,2,7,6,5,35,43)
$StandardString = ConvertFrom-SecureString $SecureString -Key $Key
```

These commands use the Advanced Encryption Standard (AES) algorithm to convert the secure string stored in the $SecureString variable to an encrypted standard string with a 192-bit key.
The resulting encrypted standard string is stored in the $standardstring variable.
These commands use the Advanced Encryption Standard (AES) algorithm to convert the secure string
stored in the `$SecureString` variable to an encrypted standard string with a 192-bit key. The
resulting encrypted standard string is stored in the `$StandardString` variable.

The first command stores a key in the `$Key` variable. The key is an array of 24 decimal numerals,
each of which must be less than 256 to fit within a single unsigned byte.

The first command stores a key in the $Key variable.
The key is an array of 24 digits, all of which are less than 256.
Because each decimal numeral represents a single byte (8 bits), the key has 24 digits for a total of
192 bits (8 x 24). This is a valid key length for the AES algorithm.

Because each digit represents a byte (8 bits), the key has 24 digits for a total of 192 bits (8 x 24).
This is a valid key length for the AES algorithm.
Each individual value is less than 256, which is the maximum value that can be stored in an unsigned byte.
The second command uses the key in the `$Key` variable to convert the secure string to an encrypted
standard string.

The second command uses the key in the $Key variable to convert the secure string to an encrypted standard string.
## PARAMETERS

### -Key

Specifies the encryption key as a byte array.

```yaml
Expand All @@ -83,8 +99,9 @@ Accept wildcard characters: False
```
### -SecureKey
Specifies the encryption key as a secure string.
The secure string value is converted to a byte array before being used as the key.
Specifies the encryption key as a secure string. The secure string value is converted to a byte
array before being used as the key.
```yaml
Type: SecureString
Expand All @@ -99,6 +116,7 @@ Accept wildcard characters: False
```
### -SecureString
Specifies the secure string to convert to an encrypted standard string.
```yaml
Expand All @@ -114,23 +132,33 @@ Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
-WarningAction, and -WarningVariable. For more information, see about_CommonParameters
(http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### System.Security.SecureString
You can pipe a SecureString object to ConvertFrom-SecureString.
You can pipe a **SecureString** object to ConvertFrom-SecureString.
## OUTPUTS
### System.String
ConvertFrom-SecureString returns a standard string object.
## NOTES
* To create a secure string from characters that are typed at the command prompt, use the AsSecureString parameter of the Read-Host cmdlet.
When you use the Key or SecureKey parameters to specify a key, the key length must be correct.
For example, a key of 128 bits can be specified as a byte array of 16 digits.
Similarly, 192-bit and 256-bit keys correspond to byte arrays of 24 and 32 digits, respectively.
- To create a secure string from characters that are typed at the command prompt, use the
**AsSecureString** parameter of the `Read-Host` cmdlet.
- When you use the **Key** or **SecureKey** parameters to specify a key, the key length must be
correct. For example, a key of 128 bits can be specified as a byte array of 16 decimal numerals.
Similarly, 192-bit and 256-bit keys correspond to byte arrays of 24 and 32 decimal numerals,
respectively.

*
## RELATED LINKS

[ConvertTo-SecureString](ConvertTo-SecureString.md)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
ms.date: 06/09/2017
schema: 2.0.0
locale: en-us
keywords: powershell,cmdlet
online version: http://go.microsoft.com/fwlink/p/?linkid=293932
external help file: Microsoft.PowerShell.Security.dll-Help.xml
title: ConvertFrom-SecureString
ms.date: 04/27/2019
schema: 2.0.0
locale: en-us
keywords: powershell,cmdlet
online version: http://go.microsoft.com/fwlink/p/?linkid=293932
external help file: Microsoft.PowerShell.Security.dll-Help.xml
title: ConvertFrom-SecureString
---

# ConvertFrom-SecureString

## SYNOPSIS
Expand All @@ -16,64 +15,75 @@ Converts a secure string into an encrypted standard string.
## SYNTAX

### Secure (Default)

```
ConvertFrom-SecureString [-SecureString] <SecureString> [[-SecureKey] <SecureString>] [<CommonParameters>]
```

### Open

```
ConvertFrom-SecureString [-SecureString] <SecureString> [-Key <Byte[]>] [<CommonParameters>]
```

## DESCRIPTION
The **ConvertFrom-SecureString** cmdlet converts a secure string (System.Security.SecureString) into an encrypted standard string (System.String).
Unlike a secure string, an encrypted standard string can be saved in a file for later use.
The encrypted standard string can be converted back to its secure string format by using the ConvertTo-SecureString cmdlet.

If an encryption key is specified by using the **Key** or **SecureKey** parameters, the Advanced Encryption Standard (AES) encryption algorithm is used.
The specified key must have a length of 128, 192, or 256 bits because those are the key lengths supported by the AES encryption algorithm.
If no key is specified, the Windows Data Protection API (DPAPI) is used to encrypt the standard string representation.
The **ConvertFrom-SecureString** cmdlet converts a secure string (**System.Security.SecureString**)
into an encrypted standard string (**System.String**). Unlike a secure string, an encrypted standard
string can be saved in a file for later use. The encrypted standard string can be converted back to
its secure string format by using the `ConvertTo-SecureString` cmdlet.

If an encryption key is specified by using the **Key** or **SecureKey** parameters, the Advanced
Encryption Standard (AES) encryption algorithm is used. The specified key must have a length of 128,
192, or 256 bits because those are the key lengths supported by the AES encryption algorithm. If no
key is specified, the Windows Data Protection API (DPAPI) is used to encrypt the standard string
representation.

## EXAMPLES

### Example 1
```
PS C:\> $SecureString = Read-Host -AsSecureString
### Example 1: Create a secure string

```powershell
$SecureString = Read-Host -AsSecureString
```

This command creates a secure string from characters that you type at the command prompt.
After entering the command, type the string you want to store as a secure string.
An asterisk (*) is displayed to represent each character that you type.
This command creates a secure string from characters that you type at the command prompt. After
entering the command, type the string you want to store as a secure string. An asterisk (`*`) is
displayed to represent each character that you type.

### Example 2
```
PS C:\> $StandardString = ConvertFrom-SecureString $SecureString
### Example 2: Convert a secure string to an encrypted standard string

```powershell
$StandardString = ConvertFrom-SecureString $SecureString
```

This command converts the secure string in the $SecureString variable to an encrypted standard string.
The resulting encrypted standard string is stored in the $StandardString variable.
This command converts the secure string in the `$SecureString` variable to an encrypted standard
string. The resulting encrypted standard string is stored in the `$StandardString` variable.

### Example 3
```
PS C:\> $Key = (3,4,2,3,56,34,254,222,1,1,2,23,42,54,33,233,1,34,2,7,6,5,35,43)
PS C:\> $StandardString = ConvertFrom-SecureString $SecureString -Key $Key
### Example 3: Convert a secure string to an encrypted standard string with a 192-bit key

```powershell
$Key = (3,4,2,3,56,34,254,222,1,1,2,23,42,54,33,233,1,34,2,7,6,5,35,43)
$StandardString = ConvertFrom-SecureString $SecureString -Key $Key
```

These commands use the Advanced Encryption Standard (AES) algorithm to convert the secure string stored in the $SecureString variable to an encrypted standard string with a 192-bit key.
The resulting encrypted standard string is stored in the $standardstring variable.
These commands use the Advanced Encryption Standard (AES) algorithm to convert the secure string
stored in the `$SecureString` variable to an encrypted standard string with a 192-bit key. The
resulting encrypted standard string is stored in the `$StandardString` variable.

The first command stores a key in the $Key variable.
The key is an array of 24 digits, all of which are less than 256.
The first command stores a key in the `$Key` variable. The key is an array of 24 decimal numerals,
each of which must be less than 256 to fit within a single unsigned byte.

Because each digit represents a byte (8 bits), the key has 24 digits for a total of 192 bits (8 x 24).
This is a valid key length for the AES algorithm.
Each individual value is less than 256, which is the maximum value that can be stored in an unsigned byte.
Because each decimal numeral represents a single byte (8 bits), the key has 24 digits for a total of
192 bits (8 x 24). This is a valid key length for the AES algorithm.

The second command uses the key in the $Key variable to convert the secure string to an encrypted standard string.
The second command uses the key in the `$Key` variable to convert the secure string to an encrypted
standard string.

## PARAMETERS

### -Key

Specifies the encryption key as a byte array.

```yaml
Expand All @@ -89,8 +99,9 @@ Accept wildcard characters: False
```
### -SecureKey
Specifies the encryption key as a secure string.
The secure string value is converted to a byte array before being used as the key.
Specifies the encryption key as a secure string. The secure string value is converted to a byte
array before being used as the key.
```yaml
Type: SecureString
Expand All @@ -105,6 +116,7 @@ Accept wildcard characters: False
```
### -SecureString
Specifies the secure string to convert to an encrypted standard string.
```yaml
Expand All @@ -120,26 +132,32 @@ Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
-WarningAction, and -WarningVariable. For more information, see about_CommonParameters
(http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### System.Security.SecureString
You can pipe a SecureString object to ConvertFrom-SecureString.
You can pipe a **SecureString** object to ConvertFrom-SecureString.
## OUTPUTS
### System.String
ConvertFrom-SecureString returns a standard string object.
## NOTES
* To create a secure string from characters that are typed at the command prompt, use the AsSecureString parameter of the Read-Host cmdlet.
When you use the Key or SecureKey parameters to specify a key, the key length must be correct.
For example, a key of 128 bits can be specified as a byte array of 16 digits.
Similarly, 192-bit and 256-bit keys correspond to byte arrays of 24 and 32 digits, respectively.
*
- To create a secure string from characters that are typed at the command prompt, use the
**AsSecureString** parameter of the `Read-Host` cmdlet.
- When you use the **Key** or **SecureKey** parameters to specify a key, the key length must be
correct. For example, a key of 128 bits can be specified as a byte array of 16 decimal numerals.
Similarly, 192-bit and 256-bit keys correspond to byte arrays of 24 and 32 decimal numerals,
respectively.

## RELATED LINKS

Expand Down
Loading

0 comments on commit f03173f

Please sign in to comment.