Documentation
¶
Overview ¶
Package ed448 provides Ed448 signing and verification support for the dsig library.
Ed448 is not included in the main dsig module because Go's standard library does not support Ed448, requiring the external github.com/cloudflare/circl module. To avoid adding this dependency for all users, Ed448 support is provided as a separate module.
To enable Ed448 support, import this package for its side effects:
import _ "github.com/lestrrat-go/dsig-circl-ed448"
This registers an "Ed448" algorithm with dsig. After importing, dsig.Sign and dsig.Verify can be used with the "Ed448" algorithm name.
Example ¶
package main
import (
"fmt"
"github.com/cloudflare/circl/sign/ed448"
"github.com/lestrrat-go/dsig"
_ "github.com/lestrrat-go/dsig-circl-ed448"
)
func main() {
// Generate an Ed448 key pair
pub, priv, err := ed448.GenerateKey(nil)
if err != nil {
fmt.Printf("failed to generate key: %s\n", err)
return
}
payload := []byte("Hello, Ed448!")
// Sign with Ed448 private key
signature, err := dsig.Sign(priv, "Ed448", payload, nil)
if err != nil {
fmt.Printf("failed to sign: %s\n", err)
return
}
// Verify with Ed448 public key
if err := dsig.Verify(pub, "Ed448", payload, signature); err != nil {
fmt.Printf("failed to verify: %s\n", err)
return
}
fmt.Println("signature verified")
}
Output: signature verified
Click to show internal directories.
Click to hide internal directories.