Skip to content

ConvertFrom-SodiumSealedBox

SYNOPSIS

Decrypts a base64-encoded, Sodium SealedBox-encrypted string.

SYNTAX

__AllParameterSets

ConvertFrom-SodiumSealedBox [-SealedBox] <string> [[-PublicKey] <string>] [-PrivateKey] <string>
 [<CommonParameters>]

ALIASES

This cmdlet has the following aliases, {{Insert list of aliases}}

DESCRIPTION

Converts a base64-encoded, Sodium SealedBox-encrypted string into its original plaintext form. Uses the provided public and private keys to decrypt the sealed message.

EXAMPLES

EXAMPLE 1

$params = @{ SealedBox = $encryptedMessage PublicKey = $publicKey PrivateKey = $privateKey } ConvertFrom-SodiumSealedBox @params

Output:

Secret message revealed!

Decrypts the given encrypted message using the specified public and private keys and returns the original string.

EXAMPLE 2

$encryptedMessage | ConvertFrom-SodiumSealedBox -PublicKey $publicKey -PrivateKey $privateKey

Output:

Confidential Data

Uses pipeline input to decrypt the given encrypted message with the specified keys.

PARAMETERS

-PrivateKey

The base64-encoded private key used for decryption.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 2
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-PublicKey

The base64-encoded public key used for decryption.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 1
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SealedBox

The base64-encoded encrypted secret string to decrypt.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases:
- CipherText
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: true
  ValueFromPipeline: true
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String

{{ Fill in the Description }}

OUTPUTS

System.String

{{ Fill in the Description }}

NOTES

Returns the original plaintext string after decryption. If decryption fails, an exception is thrown.