open-quantum-safe / liboqs-go

Go bindings for liboqs
https://openquantumsafe.org/
MIT License
69 stars 24 forks source link

Add "interface" to oqs.go for easy KEMS/Signature management #4

Closed saholmes closed 4 years ago

saholmes commented 4 years ago

Hi,

I have been using ECDSA.go and elliptic.curve. In these libraries there is an interface to enable easier usage of public and private keys. This could be useful to allow coding irrespective of the size and types of input for public and private keys.

crypto/eliptic

type Curve interface { // Params returns the parameters for the curve. Params() CurveParams // IsOnCurve reports whether the given (x,y) lies on the curve. IsOnCurve(x, y big.Int) bool // Add returns the sum of (x1,y1) and (x2,y2) Add(x1, y1, x2, y2 big.Int) (x, y big.Int) // Double returns 2(x,y) Double(x1, y1 big.Int) (x, y big.Int) // ScalarMult returns k(Bx,By) where k is a number in big-endian form. ScalarMult(x1, y1 big.Int, k []byte) (x, y big.Int) // ScalarBaseMult returns kG, where G is the base point of the group // and k is an integer in big-endian form. ScalarBaseMult(k []byte) (x, y big.Int) }

ECDSA

import "crypto/ecdsa"

type PublicKey struct { elliptic.Curve X, Y *big.Int }

Could add interface to oqs.go

vsoftco commented 4 years ago

Thanks, at this point in time we try to keep the language wrappers as close as possible to the liboqs API, and prefer to have additional extension as part of the consumer code.