Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add EC Curve secp256k1 #100

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ecdsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"io"
"math/big"

"github.com/decred/dcrd/dcrec/secp256k1/v4"
"github.com/miekg/pkcs11"
"github.com/pkg/errors"
)
Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 2 additions & 0 deletions ecdsa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (

"github.com/stretchr/testify/assert"

"github.com/decred/dcrd/dcrec/secp256k1/v4"
"github.com/stretchr/testify/require"
)

Expand All @@ -43,6 +44,7 @@ var curves = []elliptic.Curve{
elliptic.P256(),
elliptic.P384(),
elliptic.P521(),
secp256k1.S256(),
// plus something with explicit parameters
}

Expand Down
8 changes: 7 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
module github.com/ThalesIgnite/crypto11

go 1.13
go 1.17

require (
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
)
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
Expand Down