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