A lightweight Go wrapper library designed to simplify elliptic curve cryptography (ECC) operations and provide a native implementation of Schnorr Signatures. It abstracts the complexities of the crypto/elliptic package into a more ergonomic and developer-friendly API.
- Simplified ECC Algebra: Clean methods for scalar multiplication, point addition, and point doubling.
- Generic Signer Interface: Abstract
SignerandVerifierinterfaces for flexible implementation. - Twisted Edwards Support: Native implementation of Twisted Edwards curves, compatible with the common signing logic.
- Native Schnorr Signatures: High-level API for generating and verifying Schnorr signatures across different curve types.
- Safe and Verified: Comprehensive test suite ensuring mathematical correctness for both Weierstrass and Edwards curves.
Generic interfaces for signing operations, allowing for different curve parameterizations.
type Signer interface {
Sign(message *big.Int, priv *big.Int) (*SchnorrSignature, error)
}
type Verifier interface {
Verify(sig *SchnorrSignature, message *big.Int, pub ECPoint) bool
}Represents a point
type ECPoint struct {
X, Y *big.Int
}Structure representing the
go get github.com/mstrielnikov/ECCSignWrapperimport "crypto/elliptic"
curve := NewECCurve(elliptic.P256())// Example parameters for a Twisted Edwards curve
edCurve := NewEdwardsCurve(a, d, p, n, Gx, Gy)
curve := NewECCurve(edCurve)// Generate keys (returns *big.Int private and ECPoint public)
priv, pub, _ := curve.GenerateKeyPair()
// Message to sign
message := new(big.Int).SetBytes([]byte("Hello, ECC!"))
// Sign the message
signature, _ := curve.Sign(message, priv)isValid := curve.Verify(signature, message, pub)
if isValid {
fmt.Println("Signature is valid!")
}The library provides a built-in CLI for common cryptographic operations.
go run . keygen --curve p256
# or
go run . keygen --curve edwardsgo run . sign --curve p256 --priv "YOUR_PRIVATE_KEY" --msg "Hello World"go run . verify --curve p256 --pub '{"X":..., "Y":...}' --msg "Hello World" --sig '{"R":..., "S":...}'The library includes a robust test suite covering ECC algebra correctness and signature verification edge cases.
go test -v ./...This project is licensed under the MIT License - see the LICENSE file for details (if applicable).

