encrypted and decrypt with key vault code example
Example: encrypt and decrypt in hashicorp vault
>>vault write <Transit Engine path>/encrypt/<Created encryption key name> plaintext=$(base64 <<< "My Name is Ankit Sambhare")
>>vault write mytransit/encrypt/my-key plaintext=$([Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes("My Name is Ankit Sambhare")))
https://www.base64decode.org/
>>vault write mytransit/decrypt/my-key ciphertext=vault:v1:Y0W/bCFfDPyl3b+Pqj+GD7+BRcbSYXZpNkAjEAYayhDBRfUDX+w6mfJKps2FLZmvJkoxUreQfmatUevthFNRdAs/lWEULpKmQRgCEr/g
Key Value
--- -----
plaintext TQB5ACAATgBhAG0AZQAgAGkAcwAgAEEAbgBrAGkAdAAgAFMAYQBtAGIAaABhAHIAZQA=
>>base64 --decode <<< "TQB5ACAATgBhAG0AZQAgAGkAcwAgAEEAbgBrAGkAdAAgAFMAYQBtAGIAaABhAHIAZQA=
"
>>vault write mytransit/decrypt/my-key ciphertext=vault:v1:Y0W/bCFfDPyl3b+Pqj+GD7+BRcbSYXZpNkAjEAYayhDBRfUDX+w6mfJKps2FLZmvJkoxUreQfmatUevthFNRdAs/lWEULpKmQRgCEr/g | Out-File .\output
>>[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("$(Get-Content .\output | select -Skip 2 | Foreach {($_ -split '\s+',4)[1]})"))