Unprotect-CmsMessage
Decrypts content that has been encrypted by using the Cryptographic Message Syntax format.
语法
ByWinEvent (默认值)
Unprotect-CmsMessage
[-EventLogRecord] <PSObject>
[[-To] <CmsMessageRecipient[]>]
[-IncludeContext]
[<CommonParameters>]
ByContent
Unprotect-CmsMessage
[-Content] <String>
[[-To] <CmsMessageRecipient[]>]
[-IncludeContext]
[<CommonParameters>]
ByPath
Unprotect-CmsMessage
[-Path] <String>
[[-To] <CmsMessageRecipient[]>]
[-IncludeContext]
[<CommonParameters>]
ByLiteralPath
Unprotect-CmsMessage
[-LiteralPath] <String>
[[-To] <CmsMessageRecipient[]>]
[-IncludeContext]
[<CommonParameters>]
说明
The Unprotect-CmsMessage cmdlet decrypts content that has been encrypted by using the Cryptographic Message Syntax (CMS) format.
The CMS cmdlets support encryption and decryption of content using the IETF standard format for cryptographically protecting messages, as documented by RFC5652.
The CMS encryption standard uses public key cryptography, where the keys used to encrypt content (the public key) and the keys used to decrypt content (the private key) are separate. Your public key can be shared widely, and is not sensitive data. If any content is encrypted with this public key, only your private key can decrypt it. For more information, see Public-key cryptography.
Unprotect-CmsMessage decrypts content that has been encrypted in CMS format. You can run this cmdlet to decrypt content that you have encrypted by running the Protect-CmsMessage cmdlet. You can specify content that you want to decrypt as a string, by the encryption event log record ID number, or by path to the encrypted content. The Unprotect-CmsMessage cmdlet returns the decrypted content.
示例
Example 1: Decrypt a message
PS C:\> C:\Users\gabyk\Documents\PowerShell_ISEUnprotect-CmsMessage -LiteralPath "C:\Users\Test\Documents\PowerShell ISE\Future_Plans.txt" -To '0f 8j b1 ab e0 ce 35 1d 67 d2 f2 6f a2 d2 00 cl 22 z9 m9 85'
Try the new Break All command
In the following example, you decrypt content that is located at the literal path C:\Users\Test\Documents\PowerShell ISE. For the value of the required To parameter, this example uses the thumbprint of the certificate that was used to perform the encryption. The decrypted message, "Try the new Break All command," is the result.
参数
-Content
Specifies an encrypted string, or a variable containing an encrypted string.
参数属性
类型: | String |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
ByContent
Position: | 0 |
必需: | True |
来自管道的值: | True |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-EventLogRecord
Specifies an event log record ID that represents a CMS encryption operation.
参数属性
类型: | PSObject |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
ByWinEvent
Position: | 0 |
必需: | True |
来自管道的值: | True |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-IncludeContext
The Unprotect-CmsMessage cmdlet decrypts content that has been encrypted by using the Cryptographic Message Syntax (CMS) format.
The CMS cmdlets support encryption and decryption of content using the IETF standard format for cryptographically protecting messages, as documented by RFC5652.
The CMS encryption standard uses public key cryptography, where the keys used to encrypt content (the public key) and the keys used to decrypt content (the private key) are separate. Your public key can be shared widely, and is not sensitive data. If any content is encrypted with this public key, only your private key can decrypt it. For more information, see Public-key cryptography.
Unprotect-CmsMessage decrypts content that has been encrypted in CMS format. You can run this cmdlet to decrypt content that you have encrypted by running the Protect-CmsMessage cmdlet. You can specify content that you want to decrypt as a string, by the encryption event log record ID number, or by path to the encrypted content. The Unprotect-CmsMessage cmdlet returns the decrypted content.
参数属性
类型: | SwitchParameter |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-LiteralPath
Specifies the path to encrypted content that you want to decrypt. Unlike Path, the value of LiteralPath is used exactly as it is typed. No characters are interpreted as wildcard characters. If the path includes escape characters, enclose it in single quotation marks. Single quotation marks tell Windows PowerShell not to interpret any characters as escape sequences.
参数属性
类型: | String |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
ByLiteralPath
Position: | 0 |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-Path
Specifies the path to encrypted content that you want to decrypt.
参数属性
类型: | String |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
ByPath
Position: | 0 |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-To
Specifies one or more CMS message recipients, identified in any of the following formats.
- An actual certificate (as retrieved from the certificate provider).
- Path to the a file containing the certificate.
- Path to a directory containing the certificate.
- Thumbprint of the certificate (used to look in the certificate store).
- Subject name of the certificate (used to look in the certificate store).
参数属性
类型: | CmsMessageRecipient[] |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | 1 |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
输入
System.Diagnostics.Eventing.Reader.EventLogRecord or System.String
You can pipe an object containing encrypted content to Unprotect-CmsMessage.
输出
String
The unencrypted message.