Skip to content

Commit b509492

Browse files
authored
Update
1 parent 37c4ac1 commit b509492

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

main/commands/all/curve25519.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func Curve25519Genkey(StdEncoding bool, input_base64 string) {
3636
encoding.EncodeToString(hash32[:]))
3737
}
3838

39-
func genCurve25519(inputPrivateKey []byte) (privateKey []byte, publicKey []byte, hash32 [32]byte, returnErr error) {
39+
func genCurve25519(inputPrivateKey []byte) (privateKey []byte, password []byte, hash32 [32]byte, returnErr error) {
4040
if len(inputPrivateKey) > 0 {
4141
privateKey = inputPrivateKey
4242
}
@@ -57,7 +57,7 @@ func genCurve25519(inputPrivateKey []byte) (privateKey []byte, publicKey []byte,
5757
returnErr = err
5858
return
5959
}
60-
publicKey = key.PublicKey().Bytes()
61-
hash32 = blake3.Sum256(publicKey)
60+
password = key.PublicKey().Bytes()
61+
hash32 = blake3.Sum256(password)
6262
return
6363
}

main/commands/all/mlkem768.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import (
1212

1313
var cmdMLKEM768 = &base.Command{
1414
UsageLine: `{{.Exec}} mlkem768 [-i "seed (base64.RawURLEncoding)"]`,
15-
Short: `Generate key pair for ML-KEM-768 post-quantum key exchange (VLESS)`,
15+
Short: `Generate key pair for ML-KEM-768 post-quantum key exchange (VLESS Encryption)`,
1616
Long: `
17-
Generate key pair for ML-KEM-768 post-quantum key exchange (VLESS).
17+
Generate key pair for ML-KEM-768 post-quantum key exchange (VLESS Encryption).
1818
1919
Random: {{.Exec}} mlkem768
2020
@@ -57,4 +57,4 @@ func genMLKEM768(inputSeed *[64]byte) (seed [64]byte, client []byte, hash32 [32]
5757
client = key.EncapsulationKey().Bytes()
5858
hash32 = blake3.Sum256(client)
5959
return
60-
}
60+
}

main/commands/all/vlessenc.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ import (
99
)
1010

1111
var cmdVLESSEnc = &base.Command{
12-
UsageLine: `{{.Exec}} vlessenc [-pq]`,
13-
Short: `Generate encryption/decryption pair for VLESS encryption (VLESS)`,
12+
UsageLine: `{{.Exec}} vlessenc`,
13+
Short: `Generate decryption/encryption json pair (VLESS Encryption)`,
1414
Long: `
15-
Generate encryption/decryption pair with suggested default value for VLESS encryption (VLESS).
16-
17-
Generate with MLKEM: {{.Exec}} vlessenc"
15+
Generate decryption/encryption json pair (VLESS Encryption).
1816
`,
1917
}
2018

@@ -23,20 +21,19 @@ func init() {
2321
}
2422

2523
func executeVLESSEnc(cmd *base.Command, args []string) {
26-
fmt.Printf("Choose one authentication to use, do not mix them. Key exchange is Post-Quantum safe anyway.\n\n")
2724
privateKey, password, _, _ := genCurve25519(nil)
2825
serverKey := base64.RawURLEncoding.EncodeToString(privateKey)
2926
clientKey := base64.RawURLEncoding.EncodeToString(password)
3027
decryption := generateDotConfig("mlkem768x25519plus", "native", "600s", serverKey)
3128
encryption := generateDotConfig("mlkem768x25519plus", "native", "0rtt", clientKey)
32-
fmt.Printf("------ decryption (Authentication: X25519, not Post-Quantum) ------\n%v\n------ encryption (Authentication: X25519, not Post-Quantum) ------\n%v\n", decryption, encryption)
33-
fmt.Println("")
3429
seed, client, _ := genMLKEM768(nil)
3530
serverKeyPQ := base64.RawURLEncoding.EncodeToString(seed[:])
3631
clientKeyPQ := base64.RawURLEncoding.EncodeToString(client)
3732
decryptionPQ := generateDotConfig("mlkem768x25519plus", "native", "600s", serverKeyPQ)
3833
encryptionPQ := generateDotConfig("mlkem768x25519plus", "native", "0rtt", clientKeyPQ)
39-
fmt.Printf("------ decryption (Authentication: ML-KEM-768, Post-Quantum) ------\n%v\n------ encryption (Authentication: ML-KEM-768, Post-Quantum) ------\n%v\n", decryptionPQ, encryptionPQ)
34+
fmt.Printf("Choose one Authentication to use, do not mix them. Ephemeral key exchange is Post-Quantum safe anyway.\n\n")
35+
fmt.Printf("Authentication: X25519, not Post-Quantum\n\"decryption\": \"%v\"\n\"encryption\": \"%v\"\n\n", decryption, encryption)
36+
fmt.Printf("Authentication: ML-KEM-768, Post-Quantum\n\"decryption\": \"%v\"\n\"encryption\": \"%v\"\n", decryptionPQ, encryptionPQ)
4037
}
4138

4239
func generateDotConfig(fields ...string) string {

main/commands/all/x25519.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66

77
var cmdX25519 = &base.Command{
88
UsageLine: `{{.Exec}} x25519 [-i "private key (base64.RawURLEncoding)"] [--std-encoding]`,
9-
Short: `Generate key pair for X25519 key exchange (VLESS, REALITY)`,
9+
Short: `Generate key pair for X25519 key exchange (REALITY, VLESS Encryption)`,
1010
Long: `
11-
Generate key pair for X25519 key exchange (VLESS, REALITY).
11+
Generate key pair for X25519 key exchange (REALITY, VLESS Encryption).
1212
1313
Random: {{.Exec}} x25519
1414

0 commit comments

Comments
 (0)