Public/ConvertFrom-Base64Secure.ps1
|
function ConvertFrom-Base64Secure { <# .SYNOPSIS Decodes a base64 string to a secures string, then converts it to a string. .DESCRIPTION This function consumes a base64-encoded secure string, decodes it to a secure string, and converts it to a regular string. .PARAMETER Base64String The base64 string to decode and convert. .INPUTS System.String[] .OUTPUTS System.String .EXAMPLE ConvertFrom-Base64Secure -Base64String 'SGVsbG8gV29ybGQh' Consume a base64 string, decode it, and convert it to a string. .NOTES None #> [CmdletBinding()] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, Position = 0)] [string]$Base64String ) begin {} process { $unencoded = [System.Convert]::FromBase64String($Base64String) [System.Text.Encoding]::UTF8.GetString($unencoded) } end {} } |