From abd8279de05e40fca48a2c95c78df72d3bdca27f Mon Sep 17 00:00:00 2001 From: Peter Tanski Date: Tue, 15 Nov 2022 10:36:54 -0500 Subject: [PATCH 1/2] add EC Curve secp256k1 --- ecdsa.go | 5 +++++ ecdsa_test.go | 2 ++ go.mod | 1 + go.sum | 3 +++ 4 files changed, 11 insertions(+) diff --git a/ecdsa.go b/ecdsa.go index c094232..c47a70e 100644 --- a/ecdsa.go +++ b/ecdsa.go @@ -30,6 +30,7 @@ import ( "io" "math/big" + "github.com/decred/dcrd/dcrec/secp256k1/v4" "github.com/miekg/pkcs11" "github.com/pkg/errors" ) @@ -84,6 +85,10 @@ var wellKnownCurves = map[string]curveInfo{ mustMarshal(asn1.ObjectIdentifier{1, 2, 840, 10045, 3, 1, 7}), elliptic.P256(), }, + "secp256k1": { + mustMarshal(asn1.ObjectIdentifier{1, 3, 132, 0, 10}), + secp256k1.S256(), + }, "P-384": { mustMarshal(asn1.ObjectIdentifier{1, 3, 132, 0, 34}), elliptic.P384(), diff --git a/ecdsa_test.go b/ecdsa_test.go index 43407e3..e511833 100644 --- a/ecdsa_test.go +++ b/ecdsa_test.go @@ -35,6 +35,7 @@ import ( "github.com/stretchr/testify/assert" + "github.com/decred/dcrd/dcrec/secp256k1/v4" "github.com/stretchr/testify/require" ) @@ -43,6 +44,7 @@ var curves = []elliptic.Curve{ elliptic.P256(), elliptic.P384(), elliptic.P521(), + secp256k1.S256(), // plus something with explicit parameters } diff --git a/go.mod b/go.mod index c1bf0b7..d9b63a9 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/ThalesIgnite/crypto11 go 1.13 require ( + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/miekg/pkcs11 v1.0.3-0.20190429190417-a667d056470f github.com/pkg/errors v0.8.1 github.com/stretchr/testify v1.3.0 diff --git a/go.sum b/go.sum index 5d5cdb7..86bbf9f 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= github.com/miekg/pkcs11 v1.0.3-0.20190429190417-a667d056470f h1:eVB9ELsoq5ouItQBr5Tj334bhPJG/MX+m7rTchmzVUQ= github.com/miekg/pkcs11 v1.0.3-0.20190429190417-a667d056470f/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= From dec819409601cd3b31f68eea4bf86067596dd133 Mon Sep 17 00:00:00 2001 From: Peter Tanski Date: Tue, 15 Nov 2022 21:26:57 -0500 Subject: [PATCH 2/2] update package to go 1.17 --- go.mod | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index d9b63a9..4f30843 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,16 @@ module github.com/ThalesIgnite/crypto11 -go 1.13 +go 1.17 require ( - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 github.com/miekg/pkcs11 v1.0.3-0.20190429190417-a667d056470f github.com/pkg/errors v0.8.1 github.com/stretchr/testify v1.3.0 github.com/thales-e-security/pool v0.0.2 ) + +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect +)