Unprotect-Data Cmdlet

Parameters   Output Objects   Configuration Settings  

The Unprotect-Data cmdlet supports decrypting data with various symmetric algorithms including AES, 3DES, and more.

Syntax

Unprotect-Data [parameters]

Remarks

The Unprotect-Data cmdlet provides a simple way to decrypt data or files. The following algorithms are supported:

  • AES (default)
  • Blowfish
  • CAST
  • DES
  • IDEA
  • RC2
  • RC4
  • TEA
  • TripleDES
  • Twofish
  • Rijndael

To begin, specify the input data through either InputMessage or InputFile. If OutputFile is set the decrypted data will be written to the specified file, otherwise it will be returned in the OutputMessage object.

Next, set KeyPassword, and specify the Algorithm if required. Additional parameters that affect the algorithm include CipherMode and PaddingMode.

If the input is hex encoded set UseHex to hex decode the input before decrypting.

Additional options include specifying Key and InitializationVector instead of KeyPassword, decrypting block-by-block via InputBlockB, specifying KeySize, KeyPasswordAlgorithm, and more.

Encrypt Examples

#Encrypt a string with AES and default options
$encryptedData = Protect-Data -InputMessage test -KeyPassword password

#Encrypt a string to file with 3DES
Protect-Data -InputMessage test -KeyPassword password -OutputFile C:\encrypted.dat -Algorithm tripledes

#Encrypt a file to string and hex encode it
Protect-Data -InputFile C:\test.txt -KeyPassword password -UseHex

Decrypt Examples

#Decrypt a string with AES
Unprotect-Data -InputMessageB $encryptedData.DataB -KeyPassword password

#Decrypt a file to string with 3DES
Unprotect-Data -InputFile C:\encrypted.dat -KeyPassword password -Algorithm tripledes

#Decrypt a string to file and hex decode it
Unprotect-Data -InputMessage ADE51B29E36B2C1FCB4C9A1BEB8884AE -KeyPassword password -UseHex -OutputFile C:\test.decrypted.txt

Parameter List


The following is the full list of the parameters of the cmdlet with short descriptions. Click on the links for further details.

LogFileThe location of a file to which debug information is written.
AlgorithmThe encryption algorithm.
CharsetThe character set of the data.
CipherModeThe cipher mode of operation.
ConfigSpecifies one or more configuration settings.
InitializationVectorThe initialization vector (IV).
InputBlockBA block of data to decrypt.
InputFileThe file to process.
InputMessageThe message to process.
InputMessageBThe message to process.
IVBThe initialization vector (IV).
KeyThe secret key for the symmetric algorithm.
KeyBThe secret key for the symmetric algorithm.
KeyPasswordA password to generate the Key and InitializationVector .
LastBlockWhether the input block is the last block.
LogFileThe location of a file to which debug information is written.
OutputFileSpecifies the output file.
OverwriteWhether to overwrite the output file.
PaddingModeThe padding mode.
UseHexWhether input or output is hex encoded.

Output Objects


The following is the full list of the output objects returned by the cmdlet with short descriptions. Click on the links for further details.

OutputBlockThe decrypted block.
OutputMessageThe output message.

Configuration Settings


The following is a list of configuration settings for the cmdlet with short descriptions. Click on the links for further details.

BlockSizeThe block size, in bits, of the cryptographic operation.
IncludeIVWhether to prepend the IV to the output data and read the IV from the input data.
KeyPasswordAlgorithmThe hash algorithm used to derive the Key and IV from the KeyPassword property.
KeyPasswordSaltThe salt value used in conjunction with the KeyPassword to derive the Key and IV.
KeySizeThe size, in bits, of secret key for the symmetric algorithm.
UseInternalSecurityAPITells the cmdlet whether or not to use the system security libraries or an internal implementation.

 
 
Copyright (c) 2021 /n software inc. - All rights reserved.
NetCmdlets 2020 - Version 20.0 [Build 7877]