19 lines
432 B
Go
19 lines
432 B
Go
package cryptography
|
|
|
|
import (
|
|
"crypto/ed25519"
|
|
"crypto/rand"
|
|
)
|
|
|
|
func GenerateSigningKeyPair() (ed25519.PublicKey, ed25519.PrivateKey, error) {
|
|
return ed25519.GenerateKey(rand.Reader)
|
|
}
|
|
|
|
func Sign(privateKey ed25519.PrivateKey, message []byte) []byte {
|
|
return ed25519.Sign(privateKey, message)
|
|
}
|
|
|
|
func Verify(publicKey ed25519.PublicKey, message, signature []byte) bool {
|
|
return ed25519.Verify(publicKey, message, signature)
|
|
}
|