aboutsummaryrefslogtreecommitdiff
path: root/internal/crypt/sshKey.go
diff options
context:
space:
mode:
authorishaan <contact@ishaan.cc>2026-07-15 07:51:06 +0530
committerishaan <contact@ishaan.cc>2026-07-15 07:51:06 +0530
commitd369e5611df643bd83f951a94b468ef272c1bf3e (patch)
treee9b12ca81bafc53cfad7933578f2665e183bf4f2 /internal/crypt/sshKey.go
parent8ebc072fb0ceae229196e8d3d8ff15bbbc049fdd (diff)
bunch of fixes
defer file.Close() after os.OpenFile clear(sensitive) before each os.Exit(1) Shared utils.StdinScanner with 512KB buffer bytes.Equal for password comparison, append instead of string() + []byte()
Diffstat (limited to 'internal/crypt/sshKey.go')
-rw-r--r--internal/crypt/sshKey.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/crypt/sshKey.go b/internal/crypt/sshKey.go
index b0909b1..2062ebd 100644
--- a/internal/crypt/sshKey.go
+++ b/internal/crypt/sshKey.go
@@ -43,7 +43,9 @@ func edwardsToMontgomery(edPub []byte) []byte {
// Ed25519 seed -> X25519 private key.
func ed25519SeedToX25519Priv(seed []byte) []byte {
h := sha512.Sum512(seed)
- scalar := h[:32]
+ scalar := make([]byte, 32)
+ copy(scalar, h[:32])
+ clear(h[:])
scalar[0] &= 248
scalar[31] &= 127