mirror of https://github.com/XTLS/Xray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
754 B
30 lines
754 B
package all
|
|
|
|
import (
|
|
"github.com/xtls/xray-core/main/commands/base"
|
|
)
|
|
|
|
var cmdX25519 = &base.Command{
|
|
UsageLine: `{{.Exec}} x25519 [-i "private key (base64.RawURLEncoding)"] [--std-encoding]`,
|
|
Short: `Generate key pair for x25519 key exchange`,
|
|
Long: `
|
|
Generate key pair for x25519 key exchange.
|
|
|
|
Random: {{.Exec}} x25519
|
|
|
|
From private key: {{.Exec}} x25519 -i "private key (base64.RawURLEncoding)"
|
|
For Std Encoding: {{.Exec}} x25519 --std-encoding
|
|
`,
|
|
}
|
|
|
|
func init() {
|
|
cmdX25519.Run = executeX25519 // break init loop
|
|
}
|
|
|
|
var input_stdEncoding = cmdX25519.Flag.Bool("std-encoding", false, "")
|
|
var input_x25519 = cmdX25519.Flag.String("i", "", "")
|
|
|
|
func executeX25519(cmd *base.Command, args []string) {
|
|
Curve25519Genkey(false, *input_x25519)
|
|
}
|