Closed get-fooby closed 2 years ago
Don't see it as an option in https://github.com/mattosaurus/PgpCore
Probably requires opening an issue on it, and if they implement it - we'll just add it.
Per this post (https://githubhelp.com/mattosaurus/PgpCore/issues/18) encrypting to multiple keys should be possible with pgpcore >1.4
You're correct - it seems to be as simple as changing FilePathPublic to [string[]] instead of [string] and modifying logic to just convert FilePathPublic to PublicKey (FileInfo).
It looks like this was pushed to master. I am attempting to encrypt a string using your examples but receiving an error
PS C:\keys> $String = Protect-PGP -FilePathPublic @("$PSScriptRoot\Keys\PublicPGP1.asc", "$PSScriptRoot\Keys\PublicPGP2.asc") -String "This is string to encrypt"
Protect-PGP : Cannot process argument transformation on parameter 'FilePathPublic'. Cannot convert value to type
System.String.
At line:1 char:39
+ ... ePathPublic @("$PSScriptRoot\Keys\PublicPGP1.asc", "$PSScriptRoot\Key ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Protect-PGP], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Protect-PGP
Are you using github version or PSGallery one? I have not published anything yet.
From the error message it would seem you're using "old version"
function Test {
[CmdletBinding()]
param(
[string] $Test
)
}
Test -Test @("$PSScriptRoot\Keys\PublicPGP.asc", "$PSScriptRoot\Keys\PublicPGP2.asc")
You're applying array to a string, and new version takes array instead of string.
Hello, while I haven't extensively tested this, I don't think it can allow encrypting to multiple public keys. I understand it's totally do-able in PGP world - but is the script able to do this as is? Regards