Skip to content

ConvertFrom-SodiumSealedBox

SYNOPSIS

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

SYNTAX

ConvertFrom-SodiumSealedBox [-SealedBox] <String> [[-PublicKey] <String>] [-PrivateKey] <String>
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

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

-SealedBox

The base64-encoded encrypted secret string to decrypt.

Type: String
Parameter Sets: (All)
Aliases: CipherText

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-PublicKey

The base64-encoded public key used for decryption.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-PrivateKey

The base64-encoded private key used for decryption.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

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

INPUTS

OUTPUTS

System.String

NOTES

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

https://psmodule.io/Sodium/Functions/ConvertFrom-SodiumSealedBox/

https://doc.libsodium.org/public-key_cryptography/sealed_boxes