Initiliazation
This commit is contained in:
23
vv1/server/cryptmeow/cryptmeow.go
Normal file
23
vv1/server/cryptmeow/cryptmeow.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package cryptmeow
|
||||
|
||||
import (
|
||||
"angel_server/consts"
|
||||
"crypto/rand"
|
||||
|
||||
"golang.org/x/crypto/curve25519"
|
||||
)
|
||||
|
||||
func Gen_keypair() (publicKey [32]byte, privateKey [32]byte) {
|
||||
consts.Logger.Warn("Generating ephemeral keys for SSH authetification.")
|
||||
|
||||
_, err := rand.Read(privateKey[:])
|
||||
if err != nil {
|
||||
consts.Logger.Error("Failed to generate private key: " + err.Error())
|
||||
}
|
||||
|
||||
curve25519.ScalarBaseMult(&publicKey, &privateKey)
|
||||
|
||||
return publicKey, privateKey
|
||||
}
|
||||
|
||||
var ControllerPublicKey, ControllerPrivateKey [32]byte = Gen_keypair()
|
||||
Reference in New Issue
Block a user