Skip to content

Get-SodiumPublicKey

SYNOPSIS

Derives a Curve25519 public key from a provided private key using the Sodium cryptographic library.

SYNTAX

Base64 (Default)

Get-SodiumPublicKey -PrivateKey <String> [-ProgressAction <ActionPreference>] [<CommonParameters>]

AsByteArray

Get-SodiumPublicKey -PrivateKey <String> [-AsByteArray] [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

DESCRIPTION

Takes a base64-encoded Curve25519 private key and returns the corresponding base64-encoded public key. This is accomplished using the Libsodium crypto_scalarmult_base function provided by the PSModule.Sodium .NET wrapper. The function ensures compatibility with cryptographic operations requiring key exchange mechanisms.

EXAMPLES

EXAMPLE 1

Get-SodiumPublicKey -PrivateKey 'ci5/7eZ0IbGXtqQMaNvxhJ2d9qwFxA8Kjx+vivSTXqU='

Output:

WQakMx2mIAQMwLqiZteHUTwmMP6mUdK2FL0WEybWgB8=

Derives and returns the public key corresponding to the given base64-encoded private key.

EXAMPLE 2

Get-SodiumPublicKey -PrivateKey 'ci5/7eZ0IbGXtqQMaNvxhJ2d9qwFxA8Kjx+vivSTXqU=' -AsByteArray

Output:

89
6
164
51
29
166
32
4
12
192
186
162
102
215
135
81
60
38
48
254
166
81
210
182
20
189
22
19
38
214
128
31

PARAMETERS

-PrivateKey

The private key to derive the public key from.

Type: String
Parameter Sets: (All)
Aliases:

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

-AsByteArray

Returns the byte array

Type: SwitchParameter
Parameter Sets: AsByteArray
Aliases:

Required: True
Position: Named
Default value: False
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

string

byte[]

NOTES

https://psmodule.io/Sodium/Functions/Get-SodiumPublicKey/