PowerRSA icon indicating copy to clipboard operation
PowerRSA copied to clipboard

How can I encrypt a file using this script?

Open Polda18 opened this issue 5 years ago • 0 comments

Hi. I tried to pipe a file output to the script encode input and this is what it says (I've redacted the actual path, that isn't actually important):

PS C:\REDACTED> Get-Content .\REDACTED.EXT | .\PowerRSA.ps1 -Method Enc -Exponent .\rsa\PrivateKey -Modulus .\rsa\Modulus

C:\REDACTED\PowerRSA.ps1 : The input object cannot be bound to any parameters for the command either because the comman
d does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
At line:1 char:34
+ ... tage5.ps1 | .\PowerRSA.ps1 -Method Enc -Exponent .\rsa\PrivateKey -Mo ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (#TZsejlAdIwWSuD...CtZSsIfbVKQyxUy:PSObject) [PowerRSA.ps1], ParameterBindingException
    + FullyQualifiedErrorId : InputObjectNotBound,PowerRSA.ps1

C:\REDACTED\PowerRSA.ps1 : The input object cannot be bound to any parameters for the command either because the comman 
d does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
At line:1 char:34
+ ... tage5.ps1 | .\PowerRSA.ps1 -Method Enc -Exponent .\rsa\PrivateKey -Mo ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: ($xzVCMzeJliXK='...xzVCMzeJliXK))):PSObject) [PowerRSA.ps1], ParameterBindingException
    + FullyQualifiedErrorId : InputObjectNotBound,PowerRSA.ps1

What is going on? How can I encode a file? Do I need to escape those characters at the beginning of the two lines? Does the file need to have only a single line? They're kinda important, both the $ and # characters, and the two lines...

Polda18 avatar Apr 08 '21 16:04 Polda18