< Back

Encrypt-String

Mon Jan 13, 2020 6:20 am

NAME Encrypt-String



SYNOPSIS

Encrypt a string.





SYNTAX

Encrypt-String [-CertificateThumbprint] <String> [-String] <String> [[-CertificateStore] <String>]

[<CommonParameters>]





DESCRIPTION

Encrypt a string using a certificate.





PARAMETERS

-CertificateThumbprint <String>

The thumbprint of the certificate to use.



Required? true

Position? 0

Default value

Accept pipeline input? false

Accept wildcard characters? false



-String <String>

The string to encrypt.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-CertificateStore <String>

The store of the certificate.



Required? false

Position? 2

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

System.String







NOTES









-------------------------- Example 1 --------------------------



Encrypt-String -CertificateThumbprint "877D9E1EC875B2E7BF8C53151099758FBD9825C3" -String "MyPassword"

-CertificateStore CurrentUser



Encrypt the string with the specified certifiacate







PS C:\\> $certificateThumbprint

877D9E1EC875B2E7BF8C53151099758FBD9825C3



PS C:\\> $Encrypted = Encrypt-String -CertificateThumbprint "877D9E1EC875B2E7BF8C53151099758FBD9825C3" -String

"MyPassword" -CertificateStore CurrentUser



PS C:\\> $encrypted

X8t3J+rDKR7emwn64svbxEp5y/XXSHDQsykugcQDtFAZDQ/4EKC9Z7FS02W3RvwIVsxEk1bVLwzBjDJ3JDy3b0PzaX2X6bi3iFrao5bYUg7cMN5xeCJ

oozgrj2ZU4orYA/LFpfAyYSCdzvKF3MYXbu3LWmQkUaMkzsonUsGHw6MX+SqH5uGtts2/uY2I9iJ2GLQSNLOKWdwBbiUH+LYyiAWLELD6O1rfwudw9g

RjH3zl61SbN5oYS/TvBJlCWCYISOdCR66TjQ6nYYp6BhyUBH3J1wb/059B6i5hMvP8XM9WazZH/0h3uBRLxOQXnN0zPx6QXc4T274Hp724wXfh5DX2z

gOZizopYY2ujKElg0XItaJfxi9L00TPW6ZL4+JVZhfTRUV2+16hAE58eGJ8pchUSm/ZgQFsUx0+vWCzuy4cNxz5CIDn3ORVyHJ8IWlYH5bTUHU4sd0I

+gbkdEs7bxOytMwM5rF8LQMdDx8frr2mOIsqxwR1RAp2eMWXpA+Dh22N8fGioKLFPN0F8HzPlEtbTrLRc6UawwRSfP6wRQqXWR8FMBOUYXFA24gUQXp

LoxCMULMQ0m3A/bBkAcB3Mxr9BhFknVfsa10CaxQdgPBc1brTOOXflm+HKw9waftHgbDKFNMIqx66cYRzwsnJIJ0yP0rCVIJ3Jq7tDVd14=



PS C:\\>





RELATED LINKS