Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- Converts a byte encoded file to Base64 encoding to transfer data by text, like certificates
- Mimics function of openssl base64 -in certificate.pfx -out certificate.p12
- #>
- function Convert-ByteToBase64 {
- param($in,$out)
- $fileContentBytes = get-content $in -Encoding Byte
- "-----BEGIN CERTIFICATE-----" |Out-File $out
- [regex]::split(([System.Convert]::ToBase64String($fileContentBytes)), '(.{65})') | ? {$_} | out-file $out -append
- "-----END CERTIFICATE-----" | out-file $out -append
- }
Add Comment
Please, Sign In to add comment