Name
Invoke-JS7Encrypt
SYNOPSIS
Encrypts a value or file using an X.509 Certificate or Public Key
SYNTAX
Invoke-JS7Encrypt [[-Value] <String>] [[-File] <String>] [[-OutFile] <String>] [[-Certificate] <X509Certificate2>] [[-CertificatePath] <String>] [[-JavaHome] <String>] [-JavaLib] <String> [[-JavaOptions] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION
The cmdlet encrypts strings, numbers and files using asymmetric encryption,
for details see https://kb.sos-berlin.com/display/JS7/JS7+-+Encryption+and+Decryption
PARAMETERS
Value
-Value <String>
Specifies the value that should be encrypted.
Only one of the parameters -Value or -File can be used.
Required? | false |
Position? | 1 |
Default value | |
Accept pipeline input? | true (ByValue, ByPropertyName) |
Accept wildcard characters? | false |
File
-File <String>
Specifies the location of an input file that should be encrypted.
Only one of the parameters -Value or -File can be used.
Required? | false |
Position? | 2 |
Default value | |
Accept pipeline input? | true (ByValue, ByPropertyName) |
Accept wildcard characters? | false |
OutFile
-OutFile <String>
Specifies the location of the encrypted output file that should be created if the -File parameter is used.
If the output file exists, then it will be overwritten.
Required? | false |
Position? | 3 |
Default value | |
Accept pipeline input? | true (ByValue, ByPropertyName) |
Accept wildcard characters? | false |
Certificate
-Certificate <X509Certificate2>
Specifies that a value or file should be encrypted using a Certificate object.
Consider that the component that will decrypt the value or file will require access to the Private Key matching the Certificate.
Certificate objects can be retrieved from a Windows certificate store using the Certificate's thumbprint like this:
$cert = Get-ChildItem cert:\CurrentUser\my | Where { $_.Thumbprint -eq '2B03EA68F103E80D83228ABCF88A3B448CC8B257' }
Only one of the parameters -Certificate or -CertificatePath can be used.
Encryption requires use of the -JavaLib parameter that points to the location of JS7 encryption libraries.
Required? | false |
Position? | 4 |
Default value | |
Accept pipeline input? | true (ByValue, ByPropertyName) |
Accept wildcard characters? | false |
CertificatePath
-CertificatePath <String>
Specifies that a value or file should be encrypted using a Certificate or Public Key in PEM format from the indicated location.
Consider that the component that will decrypt the value or file will require access to the Private Key matching the Certificate/Public Key.
Encryption can be applied to values specified with the -Value parameter and to files specified with the -File parameter.
Only one of the parameters -Certificate or -CertificatePath can be used.
Encryption requires use of the -JavaLib parameter that points to the location of JS7 encryption libraries.
Required? | false |
Position? | 5 |
Default value | |
Accept pipeline input? | true (ByValue, ByPropertyName) |
Accept wildcard characters? | false |
JavaHome
-JavaHome <String>
Specifies the location to which Java is installed. Java is required to encrypt values or files.
If the parameter is not specified then Java will be used from the value of the JAVA_HOME or PATH environment variables.
Required? | false |
Position? | 6 |
Default value | |
Accept pipeline input? | true (ByValue, ByPropertyName) |
Accept wildcard characters? | false |
JavaLib
-JavaLib <String>
Specifies the location of the JS7 encryption libraries.
The libraries ship with Agents and are available from the Agent's <agent-home>/lib directory. For encryption outside of JS7 products the JS7 encryption libraries are available for download.
Required? | true |
Position? | 7 |
Default value | |
Accept pipeline input? | true (ByValue, ByPropertyName) |
Accept wildcard characters? | false |
JavaOptions
-JavaOptions <String>
Specifies the Java options used when invoking Java for encryption using the -CertificatePath or -Certificate parameters.
Java options can be used for example to limit memory usage as with -JavaOptions "-Xmx32m".
Required? | false |
Position? | 8 |
Default value | |
Accept pipeline input? | true (ByValue, ByPropertyName) |
Accept wildcard characters? | false |
WhatIf
-WhatIf <SwitchParameter>
Required? | false |
Position? | named |
Default value | |
Accept pipeline input? | false |
Accept wildcard characters? | false |
Confirm
-Confirm <SwitchParameter>
Required? | false |
Position? | named |
Default value | |
Accept pipeline input? | false |
Accept wildcard characters? | false |
RELATED LINKS
EXAMPLES
-------------------------- EXAMPLE 1 --------------------------
PS > $result = Invoke-JS7Encrypt -Value '12345678' -CertificatePath C:\js7\js7.encryption\agent.crt -JavaLib C:\js7\js7.encryption\lib
Returns the encryption result. The -CertificatePath argument specifies the location of the Certificate or Public Key file. The -JavaLib argument specifies the location of the JS7 encryption libraries.
-------------------------- EXAMPLE 2 --------------------------
PS > $result = Invoke-JS7Encrypt -File /tmp/secret.txt -OutFile /tmp/secret.txt.enc -CertificatePath C:\js7\js7.encryption\agent.crt -JavaLib C:\js7\js7.encryption\lib
Returns the encryption result. The -EnctypeCertificatePath argument specifies the location of the Certificate or Public Key file. The -JavaLib argument specifies the location of the JS7 encryption libraries.