EvotecIT / PSPGP

PSPGP is a PowerShell module that provides PGP functionality in PowerShell. It allows encrypting and decrypting files/folders and strings using PGP.
MIT License
59 stars 22 forks source link

Issues encrypting file #16

Closed sofiangava closed 3 months ago

sofiangava commented 10 months ago

HI,

I'm trying to encrypt a file and I am getting WARNING: Protect-PGP - Can't encrypt file C:\local\Temp\export.csv: Exception calling "EncryptFile" with "2" argument(s): "No encryption methods specified"

I am calling it this way:

Write the key text to a temporary file

$keyFilePath = Join-Path $env:TEMP "public.asc" Set-Content -Path $keyFilePath -Value $env:gpgKey

Encrypt the CSV file

$encryptedContent = Protect-PGP -FilePathPublic $keyFilePath -FilePath $localFilePathdownload

Would love some assistance to understand why this is failing :)

Sofia

PrzemyslawKlys commented 10 months ago

Dunno, probably your public key has wrong format when you save it to temporary file. Try with different encoding