Skip to content

How can I encrypt a file using this script? #3

@Polda18

Description

@Polda18

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions