Private/Storage/FlatFile/Protect-PukFlatFileData.ps1

function Protect-PukFlatFileData {
    [CmdletBinding()]
    [OutputType([string])]
    param(
        [Parameter(Mandatory)]
        [psobject]$InputObject,

        [Parameter(Mandatory)]
        [System.Security.Cryptography.X509Certificates.X509Certificate2]$Certificate
    )

    $json = $InputObject | ConvertTo-Json -Depth 10
    return Protect-CmsMessage -To $Certificate -Content $json
}