Forum Discussion
Chi_L
Sep 23, 2021Copper Contributor
Powershell - bulk decryption of files
Hi all, Hope someone with some scripting skills can help here. I'm using openssl to encrypt and decrypt files. I can decrypt single files via command line but the problem comes when I'm tryin...
LainRobertson
Oct 31, 2021Silver Contributor
Hi, Chi.
This is a bit late but may help someone with a similar question.
This simple one-liner (spread out a bit for readability) would likely suffice.
(Get-ChildItem -Path "D:\Data\*.crypt").FullName | % {
openssl.exe cms -decrypt -inkey C:\key.pem -recip C:\cert.pem -inform DER -in "$_" -out "$($_ -replace '\.crypt$', '.xml')";
}