aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/signature_cgo.go
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/signature_cgo.go')
-rw-r--r--crypto/signature_cgo.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/signature_cgo.go b/crypto/signature_cgo.go
index 381d8a1bb..340bfc221 100644
--- a/crypto/signature_cgo.go
+++ b/crypto/signature_cgo.go
@@ -76,6 +76,11 @@ func DecompressPubkey(pubkey []byte) (*ecdsa.PublicKey, error) {
return &ecdsa.PublicKey{X: x, Y: y, Curve: S256()}, nil
}
+// CompressPubkey encodes a public key to the 33-byte compressed format.
+func CompressPubkey(pubkey *ecdsa.PublicKey) []byte {
+ return secp256k1.CompressPubkey(pubkey.X, pubkey.Y)
+}
+
// S256 returns an instance of the secp256k1 curve.
func S256() elliptic.Curve {
return secp256k1.S256()