2023-02-15 18:07:12 +02:00
|
|
|
package all
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/xtls/xray-core/main/commands/base"
|
|
|
|
)
|
|
|
|
|
|
|
|
var cmdX25519 = &base.Command{
|
2023-11-18 05:27:17 +02:00
|
|
|
UsageLine: `{{.Exec}} x25519 [-i "private key (base64.RawURLEncoding)"] [--std-encoding]`,
|
2023-02-15 18:07:12 +02:00
|
|
|
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)"
|
2023-11-18 05:27:17 +02:00
|
|
|
For Std Encoding: {{.Exec}} x25519 --std-encoding
|
2023-02-15 18:07:12 +02:00
|
|
|
`,
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
cmdX25519.Run = executeX25519 // break init loop
|
|
|
|
}
|
|
|
|
|
2023-11-18 05:27:17 +02:00
|
|
|
var input_stdEncoding = cmdX25519.Flag.Bool("std-encoding", false, "")
|
2023-12-12 03:52:10 +02:00
|
|
|
var input_x25519 = cmdX25519.Flag.String("i", "", "")
|
2023-02-15 18:07:12 +02:00
|
|
|
|
|
|
|
func executeX25519(cmd *base.Command, args []string) {
|
2023-12-12 03:52:10 +02:00
|
|
|
Curve25519Genkey(false, *input_x25519)
|
2023-02-15 18:07:12 +02:00
|
|
|
}
|