Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sidecar
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
sidecar
Commits
97649fce
Commit
97649fce
authored
Nov 18, 2021
by
suyanlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update dep and Add register bls package
parent
2c9ea07f
Pipeline
#8259
failed with stages
Changes
3
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
20 deletions
+50
-20
go.mod
go.mod
+2
-1
go.sum
go.sum
+4
-19
bls.go
pkg/crypto/bls/bls.go
+44
-0
No files found.
go.mod
View file @
97649fce
...
...
@@ -30,7 +30,7 @@ require (
github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd
github.com/hashicorp/go-multierror v1.1.0
github.com/hashicorp/go-plugin v1.3.0
github.com/herumi/bls-eth-go-binary v0.0.0-2021
0917013441-d37c07cfda4e
github.com/herumi/bls-eth-go-binary v0.0.0-2021
1108015406-b5186ba08dc7
github.com/huandu/skiplist v1.2.0
github.com/huandu/xstrings v1.3.2
github.com/hyperledger/fabric v2.0.1+incompatible
...
...
@@ -195,3 +195,4 @@ require (
)
replace github.com/libp2p/go-libp2p-core => github.com/libp2p/go-libp2p-core v0.5.6
replace github.com/meshplus/bitxhub-kit => github.com/suyanlong/bitxhub-kit v1.2.1-0.20211118095742-332b6c4e4b9f
go.sum
View file @
97649fce
This diff is collapsed.
Click to expand it.
pkg/crypto/bls/bls.go
View file @
97649fce
package
bls
import
(
"fmt"
"github.com/herumi/bls-eth-go-binary/bls"
"github.com/meshplus/bitxhub-kit/crypto"
"github.com/meshplus/bitxhub-kit/crypto/asym"
"github.com/meshplus/bitxhub-kit/crypto/asym/ecdsa"
"github.com/meshplus/bitxhub-kit/types"
)
func
init
()
{
asym
.
RegisterCrypto1
(
BlsEth
,
"BlsEth"
,
GenerateKeyPair
,
Verify
,
UnmarshalPrivateKey
,
)
}
func
Verify
(
opt
crypto
.
KeyType
,
sig
,
digest
[]
byte
,
from
types
.
Address
)
(
bool
,
error
)
{
if
len
(
sig
)
==
0
{
return
false
,
fmt
.
Errorf
(
"empty sig data"
)
}
if
opt
!=
BlsEth
{
return
false
,
fmt
.
Errorf
(
"not supported %d"
,
opt
)
}
return
true
,
nil
}
func
UnmarshalPrivateKey
(
data
[]
byte
,
opt
crypto
.
KeyType
)
(
crypto
.
PrivateKey
,
error
)
{
if
len
(
data
)
==
0
{
return
nil
,
fmt
.
Errorf
(
"empty private key data"
)
}
if
opt
!=
BlsEth
{
return
nil
,
fmt
.
Errorf
(
"not supported %d"
,
opt
)
}
pk
:=
&
PrivateKey
{
curve
:
BlsEth
,
SecretKey
:
&
bls
.
SecretKey
{},
}
err
:=
pk
.
Deserialize
(
data
)
if
err
!=
nil
{
return
nil
,
err
}
return
pk
,
nil
}
type
Sign
=
bls
.
Sign
var
HashAndMapToSignature
=
bls
.
HashAndMapToSignature
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment