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> [<CommonParameters>]

AsByteArray

Get-SodiumPublicKey -PrivateKey <string> -AsByteArray [<CommonParameters>]

ALIASES

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

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

-AsByteArray

Returns the byte array

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: AsByteArray
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-PrivateKey

The private key to derive the public key from.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  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

OUTPUTS

string

{{ Fill in the Description }}

byte

{{ Fill in the Description }}

System.String

{{ Fill in the Description }}

System.Byte

{{ Fill in the Description }}

NOTES