< Back

ConvertTo-PKISecureString

Sun Jan 19, 2020 6:37 pm

NAME ConvertTo-PKISecureString



SYNOPSIS

Converts a string of encrypted text back into a SecureString object with the private key of a PKI certificate.





SYNTAX

ConvertTo-PKISecureString [-EncryptedString] <String> -Thumbprint <String> [-CertificateStore <String>]

[<CommonParameters>]





DESCRIPTION





PARAMETERS

-EncryptedString <String>

The string of encrypted text to convert back into a SecureString object



Required? true

Position? 2

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Thumbprint <String>

The ThumbPrint of a certificate on the local computer that will be used to decrypt the string.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-CertificateStore <String>

Specifies the certifcate store of the specified certificate thumbprint. Either LocalMachine or CurrentUser.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>$EncryptedText = Get-Content ./encryptedText.txt



$MySecretValue = ConvertTo-PKISecureString -EncryptedString $EncryptedValue -Thumbprint

'87BB70A19A7671D389F49AF4C9608B2F381FDD80'



Reads an encrypted string from disk and decrypts it back into a SecureString.











RELATED LINKS