New-SodiumKeyPair¶
SYNOPSIS¶
Generates a new Sodium key pair.
SYNTAX¶
NewKeyPair (Default)¶
New-SodiumKeyPair [<CommonParameters>]
SeededKeyPair¶
New-SodiumKeyPair -Seed <string> [<CommonParameters>]
ALIASES¶
This cmdlet has the following aliases, {{Insert list of aliases}}
DESCRIPTION¶
This function creates a new cryptographic key pair using Sodium's PublicKeyBox. The keys are returned as a PowerShell custom object, with both the public and private keys encoded in base64 format.
If a seed is provided, the key pair is deterministically generated using a SHA-256 derived seed. This ensures that the same input seed will always produce the same key pair.
EXAMPLES¶
EXAMPLE 1¶
New-SodiumKeyPair
Output:
PublicKey PrivateKey
--------- ----------
Ac0wdsq6lqLGktckJrasPcTbVRuUCU+OKzVpMno+v0g= PVXI64v00+aT2b2O6Q4l+SfMBUY2R/Nogsl2mp/hXAs=
Generates a new key pair and returns a custom object containing the base64-encoded public and private keys.
EXAMPLE 2¶
New-SodiumKeyPair -Seed "MySecureSeed"
Output:
PublicKey PrivateKey
--------- ----------
WQakMx2mIAQMwLqiZteHUTwmMP6mUdK2FL0WEybWgB8= ci5/7eZ0IbGXtqQMaNvxhJ2d9qwFxA8Kjx+vivSTXqU=
Generates a deterministic key pair using the given seed string. The same seed will produce the same key pair every time.
EXAMPLE 3¶
"MySecureSeed" | New-SodiumKeyPair
Output:
PublicKey PrivateKey
--------- ----------
WQakMx2mIAQMwLqiZteHUTwmMP6mUdK2FL0WEybWgB8= ci5/7eZ0IbGXtqQMaNvxhJ2d9qwFxA8Kjx+vivSTXqU=
Generates a deterministic key pair using the given seed string via pipeline. The same seed will produce the same key pair every time.
PARAMETERS¶
-Seed¶
A seed value to use for key generation.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: SeededKeyPair
Position: Named
IsRequired: true
ValueFromPipeline: true
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¶
System.String¶
{{ Fill in the Description }}
OUTPUTS¶
PSCustomObject¶
{{ Fill in the Description }}
System.Management.Automation.PSObject¶
{{ Fill in the Description }}
NOTES¶
Returns a PowerShell custom object with the following properties: - PublicKey: The base64-encoded public key. - PrivateKey: The base64-encoded private key. If key generation fails, an exception is thrown.