Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
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
plugin
Commits
cf216df2
Unverified
Commit
cf216df2
authored
Jun 18, 2020
by
33cn
Committed by
GitHub
Jun 18, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #858 from bysomeone/update-chain33
Update chain33
parents
a344d03e
12221338
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
99 additions
and
59 deletions
+99
-59
appveyor.yml
appveyor.yml
+2
-2
go.mod
go.mod
+5
-4
go.sum
go.sum
+0
-0
node_test.go
plugin/consensus/dpos/node_test.go
+3
-0
util_test.go
plugin/consensus/dpos/types/util_test.go
+5
-0
bls.go
plugin/crypto/bls/bls.go
+1
-1
ecdsa.go
plugin/crypto/ecdsa/ecdsa.go
+1
-1
sm2.go
plugin/crypto/sm2/sm2.go
+1
-1
gmimpl.go
plugin/dapp/cert/authority/core/gmimpl.go
+2
-1
ca-cert.pem
...pp/cert/authority/test/authdir/crypto/cacerts/ca-cert.pem
+11
-11
68fe61b66aa6d9cd39b7eabbe756c179c69889ce70421b8b67bb2373be84fa24_sk
...a6d9cd39b7eabbe756c179c69889ce70421b8b67bb2373be84fa24_sk
+6
-0
9a20a7b90284e90274f7827d85aa661ab287e252751cab4314fd0f5c371187a3_sk
...84e90274f7827d85aa661ab287e252751cab4314fd0f5c371187a3_sk
+0
-6
User@Chain33-cert.pem
...ority/test/authdir/crypto/signcerts/User@Chain33-cert.pem
+11
-11
sm2.go
...in/dapp/cert/authority/tools/cryptogen/factory/csp/sm2.go
+1
-1
generatorimpl.go
...authority/tools/cryptogen/generator/impl/generatorimpl.go
+3
-3
certutils.go
...rt/authority/tools/cryptogen/generator/utils/certutils.go
+36
-12
onetimeed25519.go
plugin/dapp/privacy/crypto/onetimeed25519.go
+1
-1
ring_signature_crypto.go
plugin/dapp/privacy/crypto/ring_signature_crypto.go
+1
-1
privacybizpolicy_test.go
plugin/dapp/privacy/wallet/privacybizpolicy_test.go
+2
-2
ticket_test.go
plugin/dapp/ticket/wallet/ticket_test.go
+5
-0
ethereum_test.go
...pp/x2ethereum/ebrelayer/relayer/ethereum/ethereum_test.go
+1
-1
base.go
plugin/mempool/para/base.go
+1
-0
No files found.
appveyor.yml
View file @
cf216df2
...
@@ -9,9 +9,9 @@ clone_folder: c:\gopath\src\github.com\33cn\plugin
...
@@ -9,9 +9,9 @@ clone_folder: c:\gopath\src\github.com\33cn\plugin
environment
:
environment
:
GOPATH
:
c:\gopath
GOPATH
:
c:\gopath
DEPTESTBYPASS501
:
1
DEPTESTBYPASS501
:
1
GOVERSION
:
1.1
2
GOVERSION
:
1.1
3.9
GO111MODULE
:
on
GO111MODULE
:
on
#init:
#init:
# - git config --global core.autocrlf input
# - git config --global core.autocrlf input
...
...
go.mod
View file @
cf216df2
...
@@ -3,11 +3,12 @@ module github.com/33cn/plugin
...
@@ -3,11 +3,12 @@ module github.com/33cn/plugin
go 1.12
go 1.12
require (
require (
github.com/33cn/chain33 v0.0.0-202006
05043414-355d96f9ec97
github.com/33cn/chain33 v0.0.0-202006
18095014-8773a3526b6f
github.com/BurntSushi/toml v0.3.1
github.com/BurntSushi/toml v0.3.1
github.com/NebulousLabs/Sia v1.3.7
github.com/NebulousLabs/Sia v1.3.7
github.com/beorn7/perks v1.0.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bitly/go-simplejson v0.5.0
github.com/bitly/go-simplejson v0.5.0
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/btcsuite/btcd v0.20.1-beta
github.com/btcsuite/btcd v0.20.1-beta
github.com/coreos/etcd v3.3.15+incompatible
github.com/coreos/etcd v3.3.15+incompatible
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect
...
@@ -17,7 +18,7 @@ require (
...
@@ -17,7 +18,7 @@ require (
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/protobuf v1.3.4
github.com/golang/protobuf v1.3.4
github.com/hashicorp/golang-lru v0.5.
3
github.com/hashicorp/golang-lru v0.5.
4
github.com/huin/goupnp v1.0.0
github.com/huin/goupnp v1.0.0
github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458
github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458
github.com/miguelmota/go-solidity-sha3 v0.1.0
github.com/miguelmota/go-solidity-sha3 v0.1.0
...
@@ -32,13 +33,13 @@ require (
...
@@ -32,13 +33,13 @@ require (
github.com/rs/cors v1.6.0
github.com/rs/cors v1.6.0
github.com/spf13/cobra v0.0.5
github.com/spf13/cobra v0.0.5
github.com/stretchr/testify v1.4.0
github.com/stretchr/testify v1.4.0
github.com/tjfoc/gmsm v
0.0.0-20171124023159-98aa888b79d8
github.com/tjfoc/gmsm v
1.3.1
github.com/valyala/fasthttp v1.5.0
github.com/valyala/fasthttp v1.5.0
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect
go.uber.org/atomic v1.4.0 // indirect
go.uber.org/atomic v1.4.0 // indirect
go.uber.org/multierr v1.2.0 // indirect
go.uber.org/multierr v1.2.0 // indirect
go.uber.org/zap v1.10.0 // indirect
go.uber.org/zap v1.10.0 // indirect
golang.org/x/crypto v0.0.0-20191
011191535-87dc89f01550
golang.org/x/crypto v0.0.0-20191
219195013-becbf705a915
golang.org/x/net v0.0.0-20200301022130-244492dfa37a
golang.org/x/net v0.0.0-20200301022130-244492dfa37a
golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0 // indirect
golang.org/x/time v0.0.0-20190921001708-c4c64cad1fd0 // indirect
google.golang.org/grpc v1.28.0
google.golang.org/grpc v1.28.0
...
...
go.sum
View file @
cf216df2
This diff is collapsed.
Click to expand it.
plugin/consensus/dpos/node_test.go
View file @
cf216df2
...
@@ -10,6 +10,8 @@ import (
...
@@ -10,6 +10,8 @@ import (
"testing"
"testing"
"time"
"time"
"github.com/33cn/chain33/system/p2p/dht/protocol"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/executor"
"github.com/33cn/chain33/executor"
"github.com/33cn/chain33/p2p"
"github.com/33cn/chain33/p2p"
...
@@ -435,6 +437,7 @@ func TestIP2IPPort(t *testing.T) {
...
@@ -435,6 +437,7 @@ func TestIP2IPPort(t *testing.T) {
func
TestNode
(
t
*
testing
.
T
)
{
func
TestNode
(
t
*
testing
.
T
)
{
fmt
.
Println
(
"=======start TestNode!======="
)
fmt
.
Println
(
"=======start TestNode!======="
)
Init
()
Init
()
protocol
.
ClearEventHandler
()
q1
,
chain1
,
s1
,
mem1
,
exec1
,
cs1
,
p2p1
:=
initEnvDpos1
(
"chain33.test1.toml"
)
q1
,
chain1
,
s1
,
mem1
,
exec1
,
cs1
,
p2p1
:=
initEnvDpos1
(
"chain33.test1.toml"
)
defer
clearTestData1
()
defer
clearTestData1
()
...
...
plugin/consensus/dpos/types/util_test.go
View file @
cf216df2
...
@@ -6,6 +6,7 @@ import (
...
@@ -6,6 +6,7 @@ import (
"os"
"os"
"strings"
"strings"
"sync"
"sync"
"syscall"
"testing"
"testing"
"time"
"time"
...
@@ -19,6 +20,8 @@ func init() {
...
@@ -19,6 +20,8 @@ func init() {
func
TestWriteFile
(
t
*
testing
.
T
)
{
func
TestWriteFile
(
t
*
testing
.
T
)
{
filename
:=
"./tmp_priv_validator.json"
filename
:=
"./tmp_priv_validator.json"
mask
:=
syscall
.
Umask
(
0
)
defer
syscall
.
Umask
(
mask
)
err
:=
WriteFile
(
filename
,
[]
byte
(
privValidatorFile
),
0664
)
err
:=
WriteFile
(
filename
,
[]
byte
(
privValidatorFile
),
0664
)
require
.
Nil
(
t
,
err
)
require
.
Nil
(
t
,
err
)
...
@@ -35,6 +38,8 @@ func TestWriteFile(t *testing.T) {
...
@@ -35,6 +38,8 @@ func TestWriteFile(t *testing.T) {
}
}
func
TestWriteFileAtomic
(
t
*
testing
.
T
)
{
func
TestWriteFileAtomic
(
t
*
testing
.
T
)
{
mask
:=
syscall
.
Umask
(
0
)
defer
syscall
.
Umask
(
mask
)
filename
:=
"./tmp_priv_validator.json"
filename
:=
"./tmp_priv_validator.json"
err
:=
WriteFileAtomic
(
filename
,
[]
byte
(
privValidatorFile
),
0664
)
err
:=
WriteFileAtomic
(
filename
,
[]
byte
(
privValidatorFile
),
0664
)
require
.
Nil
(
t
,
err
)
require
.
Nil
(
t
,
err
)
...
...
plugin/crypto/bls/bls.go
View file @
cf216df2
...
@@ -303,6 +303,6 @@ const Name = "bls"
...
@@ -303,6 +303,6 @@ const Name = "bls"
const
ID
=
259
const
ID
=
259
func
init
()
{
func
init
()
{
crypto
.
Register
(
Name
,
&
Driver
{})
crypto
.
Register
(
Name
,
&
Driver
{}
,
false
)
crypto
.
RegisterType
(
Name
,
ID
)
crypto
.
RegisterType
(
Name
,
ID
)
}
}
plugin/crypto/ecdsa/ecdsa.go
View file @
cf216df2
...
@@ -223,7 +223,7 @@ const Name = "auth_ecdsa"
...
@@ -223,7 +223,7 @@ const Name = "auth_ecdsa"
const
ID
=
257
const
ID
=
257
func
init
()
{
func
init
()
{
crypto
.
Register
(
Name
,
&
Driver
{})
crypto
.
Register
(
Name
,
&
Driver
{}
,
false
)
crypto
.
RegisterType
(
Name
,
ID
)
crypto
.
RegisterType
(
Name
,
ID
)
}
}
...
...
plugin/crypto/sm2/sm2.go
View file @
cf216df2
...
@@ -17,6 +17,6 @@ const name = "auth_sm2"
...
@@ -17,6 +17,6 @@ const name = "auth_sm2"
const
id
=
258
const
id
=
258
func
init
()
{
func
init
()
{
crypto
.
Register
(
name
,
&
sm2Driver
{})
crypto
.
Register
(
name
,
&
sm2Driver
{}
,
false
)
crypto
.
RegisterType
(
name
,
id
)
crypto
.
RegisterType
(
name
,
id
)
}
}
plugin/dapp/cert/authority/core/gmimpl.go
View file @
cf216df2
...
@@ -90,7 +90,8 @@ func (validator *gmValidator) Validate(certByte []byte, pubKey []byte) error {
...
@@ -90,7 +90,8 @@ func (validator *gmValidator) Validate(certByte []byte, pubKey []byte) error {
return
fmt
.
Errorf
(
"Error publick key type in transaction. expect SM2"
)
return
fmt
.
Errorf
(
"Error publick key type in transaction. expect SM2"
)
}
}
if
!
bytes
.
Equal
(
pubKey
,
sm2_util
.
SerializePublicKey
(
ParseECDSAPubKey2SM2PubKey
(
certPubKey
)))
{
if
!
bytes
.
Equal
(
pubKey
,
sm2_util
.
SerializePublicKey
(
ParseECDSAPubKey2SM2PubKey
(
certPubKey
),
len
(
pubKey
)
==
sm2_util
.
SM2PublicKeyCompressed
))
{
return
fmt
.
Errorf
(
"Invalid public key"
)
return
fmt
.
Errorf
(
"Invalid public key"
)
}
}
...
...
plugin/dapp/cert/authority/test/authdir/crypto/cacerts/ca-cert.pem
View file @
cf216df2
-----BEGIN CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB
7TCCAZKgAwIBAgIRAK66R1SxVZQDN0Dkz0ZhbCcwCgYIKoEcz1UBg3UwRzEL
MIIB
6zCCAZGgAwIBAgIQVq9SxucwdINw2WUMlNFpdjAKBggqgRzPVQGDdTBHMQsw
MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDV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WcBT0gVSbHk7k+aJzG3uRdORTbbvmLgbG2QCIF3e0/m0aNRlvF6gPxBJ+JBR
L8pSDDRDCvGds8+nemzYtpw=
R0sbv9eyrSEFMwx/ZyGJ
-----END CERTIFICATE-----
-----END CERTIFICATE-----
plugin/dapp/cert/authority/test/authdir/crypto/keystore/68fe61b66aa6d9cd39b7eabbe756c179c69889ce70421b8b67bb2373be84fa24_sk
0 → 100644
View file @
cf216df2
-----BEGIN PRIVATE KEY-----
MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQg86AAL0bRgFW6RhFX
no7CVphI1U2csfrjwPuYn3FXaF2gCgYIKoEcz1UBgi2hRANCAASR8Yb//+y/GMLy
D36FLLO80oxUPtD6AtVoh9UIuC1b0QzA4+zkUDUk3zwdZ1pMZZKGZ48vE6KtAcFB
uqU7L784
-----END PRIVATE KEY-----
plugin/dapp/cert/authority/test/authdir/crypto/keystore/9a20a7b90284e90274f7827d85aa661ab287e252751cab4314fd0f5c371187a3_sk
deleted
100644 → 0
View file @
a344d03e
-----BEGIN PRIVATE KEY-----
MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgUDB2WJbWpyxcbwXq
m951EkEDNdRmUo6tzgtFy7nmcVegCgYIKoEcz1UBgi2hRANCAATPC6Ja8zQ9hhaL
eusbDK9ttb4a4yRjAWKXUDjO3r/zA6ROmeTQAc/fNlZXxKr+TXiAe+r2fBGBIRr3
hhql7gqw
-----END PRIVATE KEY-----
plugin/dapp/cert/authority/test/authdir/crypto/signcerts/User@Chain33-cert.pem
View file @
cf216df2
-----BEGIN CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB
5DCCAYqgAwIBAgIRAOQUQ5hzHvaJCs4FzFKJnM8wCgYIKoEcz1UBg3UwRzEL
MIIB
4zCCAYmgAwIBAgIQdKBE3pdDBMaadMbZ30K7aTAKBggqgRzPVQGDdTBHMQsw
MAkGA1UEBhMCVVMxEzARBgNVBAgTCkN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DmTdp5EIbRdxm33Sk
zMjWsMVlZERtUuW3+uYm+bCRjOgCIQDZf8dKxkBd155hiilDQ4RR4Xa8+ZGcPslm
7PV9pdBVWYU
=
Nm+S1txiqA=
=
-----END CERTIFICATE-----
-----END CERTIFICATE-----
plugin/dapp/cert/authority/tools/cryptogen/factory/csp/sm2.go
View file @
cf216df2
...
@@ -19,7 +19,7 @@ func (s *sm2Signer) Sign(k Key, digest []byte, opts SignerOpts) (signature []byt
...
@@ -19,7 +19,7 @@ func (s *sm2Signer) Sign(k Key, digest []byte, opts SignerOpts) (signature []byt
}
}
func
signSM2
(
k
*
sm2
.
PrivateKey
,
digest
[]
byte
,
opts
SignerOpts
)
(
signature
[]
byte
,
err
error
)
{
func
signSM2
(
k
*
sm2
.
PrivateKey
,
digest
[]
byte
,
opts
SignerOpts
)
(
signature
[]
byte
,
err
error
)
{
r
,
s
,
err
:=
sm2
.
S
ign
(
k
,
digest
)
r
,
s
,
err
:=
sm2
.
S
m2Sign
(
k
,
digest
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
plugin/dapp/cert/authority/tools/cryptogen/generator/impl/generatorimpl.go
View file @
cf216df2
...
@@ -220,7 +220,7 @@ func newSM2CA(baseDir, name string) (*SM2CA, error) {
...
@@ -220,7 +220,7 @@ func newSM2CA(baseDir, name string) (*SM2CA, error) {
sm2cert
:=
utils
.
ParseX509CertificateToSm2
(
&
template
)
sm2cert
:=
utils
.
ParseX509CertificateToSm2
(
&
template
)
sm2cert
.
PublicKey
=
smPubKey
sm2cert
.
PublicKey
=
smPubKey
x509Cert
,
err
:=
genCertificateGMSM2
(
baseDir
,
name
,
sm2cert
,
sm2cert
,
priv
)
x509Cert
,
err
:=
genCertificateGMSM2
(
baseDir
,
name
,
sm2cert
,
sm2cert
,
signer
)
if
err
==
nil
{
if
err
==
nil
{
ca
=
&
SM2CA
{
ca
=
&
SM2CA
{
Name
:
name
,
Name
:
name
,
...
@@ -247,7 +247,7 @@ func (ca *SM2CA) SignCertificate(baseDir, name string, sans []string, pub interf
...
@@ -247,7 +247,7 @@ func (ca *SM2CA) SignCertificate(baseDir, name string, sans []string, pub interf
template
.
PublicKey
=
pub
template
.
PublicKey
=
pub
sm2Tpl
:=
utils
.
ParseX509CertificateToSm2
(
&
template
)
sm2Tpl
:=
utils
.
ParseX509CertificateToSm2
(
&
template
)
cert
,
err
:=
genCertificateGMSM2
(
baseDir
,
name
,
sm2Tpl
,
ca
.
SignCert
,
ca
.
S
m2Key
)
cert
,
err
:=
genCertificateGMSM2
(
baseDir
,
name
,
sm2Tpl
,
ca
.
SignCert
,
ca
.
S
igner
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -282,7 +282,7 @@ func (ca *SM2CA) GenerateLocalUser(baseDir, name string) error {
...
@@ -282,7 +282,7 @@ func (ca *SM2CA) GenerateLocalUser(baseDir, name string) error {
return
err
return
err
}
}
func
genCertificateGMSM2
(
baseDir
,
name
string
,
template
,
parent
*
sm2
.
Certificate
,
key
c
sp
.
Key
)
(
*
sm2
.
Certificate
,
error
)
{
func
genCertificateGMSM2
(
baseDir
,
name
string
,
template
,
parent
*
sm2
.
Certificate
,
key
c
rypto
.
Signer
)
(
*
sm2
.
Certificate
,
error
)
{
certBytes
,
err
:=
utils
.
CreateCertificateToMem
(
template
,
parent
,
key
)
certBytes
,
err
:=
utils
.
CreateCertificateToMem
(
template
,
parent
,
key
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
plugin/dapp/cert/authority/tools/cryptogen/generator/utils/certutils.go
View file @
cf216df2
...
@@ -5,40 +5,64 @@
...
@@ -5,40 +5,64 @@
package
utils
package
utils
import
(
import
(
"crypto"
"crypto/rand"
"crypto/x509"
"crypto/x509"
"encoding/pem"
"os"
"github.com/33cn/plugin/plugin/dapp/cert/authority/tools/cryptogen/factory/csp"
"github.com/tjfoc/gmsm/sm2"
"github.com/tjfoc/gmsm/sm2"
)
)
// CreateCertificateToMem 证书转mem
// CreateCertificateToMem 证书转mem
func
CreateCertificateToMem
(
template
,
parent
*
sm2
.
Certificate
,
key
csp
.
Key
)
(
cert
[]
byte
,
err
error
)
{
func
CreateCertificateToMem
(
template
,
parent
*
sm2
.
Certificate
,
key
crypto
.
Signer
)
([]
byte
,
error
)
{
pk
:=
key
.
(
*
csp
.
SM2PrivateKey
)
.
PrivKey
pub
,
_
:=
template
.
PublicKey
.
(
*
sm2
.
PublicKey
)
pub
,
_
:=
template
.
PublicKey
.
(
*
sm2
.
PublicKey
)
var
puk
sm2
.
PublicKey
var
puk
sm2
.
PublicKey
puk
.
Curve
=
sm2
.
P256Sm2
()
puk
.
Curve
=
sm2
.
P256Sm2
()
puk
.
X
=
pub
.
X
puk
.
X
=
pub
.
X
puk
.
Y
=
pub
.
Y
puk
.
Y
=
pub
.
Y
cert
,
err
=
sm2
.
CreateCertificateToMem
(
template
,
parent
,
&
puk
,
pk
)
return
der
,
err
:=
sm2
.
CreateCertificate
(
rand
.
Reader
,
template
,
parent
,
&
puk
,
key
)
if
err
!=
nil
{
return
nil
,
err
}
block
:=
&
pem
.
Block
{
Type
:
"CERTIFICATE"
,
Bytes
:
der
,
}
return
pem
.
EncodeToMemory
(
block
),
nil
}
}
// CreateCertificateToPem 证书转pem
// CreateCertificateToPem 证书转pem
func
CreateCertificateToPem
(
FileName
string
,
template
,
parent
*
sm2
.
Certificate
,
key
csp
.
Key
)
error
{
func
CreateCertificateToPem
(
FileName
string
,
template
,
parent
*
sm2
.
Certificate
,
key
crypto
.
Signer
)
error
{
pk
:=
key
.
(
*
csp
.
SM2PrivateKey
)
.
PrivKey
pub
,
_
:=
template
.
PublicKey
.
(
*
sm2
.
PublicKey
)
pub
,
_
:=
template
.
PublicKey
.
(
*
sm2
.
PublicKey
)
var
puk
sm2
.
PublicKey
var
puk
sm2
.
PublicKey
puk
.
Curve
=
sm2
.
P256Sm2
()
puk
.
Curve
=
sm2
.
P256Sm2
()
puk
.
X
=
pub
.
X
puk
.
X
=
pub
.
X
puk
.
Y
=
pub
.
Y
puk
.
Y
=
pub
.
Y
_
,
err
:=
sm2
.
CreateCertificateToPem
(
FileName
,
template
,
parent
,
&
puk
,
pk
)
return
err
der
,
err
:=
sm2
.
CreateCertificate
(
rand
.
Reader
,
template
,
parent
,
&
puk
,
key
)
if
err
!=
nil
{
return
err
}
block
:=
&
pem
.
Block
{
Type
:
"CERTIFICATE"
,
Bytes
:
der
,
}
file
,
err
:=
os
.
Create
(
FileName
)
if
err
!=
nil
{
return
err
}
defer
file
.
Close
()
err
=
pem
.
Encode
(
file
,
block
)
if
err
!=
nil
{
return
err
}
return
nil
}
}
// ParseX509CertificateToSm2 解析x509格式为sm2格式证书
// ParseX509CertificateToSm2 解析x509格式为sm2格式证书
...
@@ -51,7 +75,7 @@ func ParseX509CertificateToSm2(x509Cert *x509.Certificate) *sm2.Certificate {
...
@@ -51,7 +75,7 @@ func ParseX509CertificateToSm2(x509Cert *x509.Certificate) *sm2.Certificate {
RawIssuer
:
x509Cert
.
RawIssuer
,
RawIssuer
:
x509Cert
.
RawIssuer
,
Signature
:
x509Cert
.
Signature
,
Signature
:
x509Cert
.
Signature
,
SignatureAlgorithm
:
sm2
.
S
ignatureAlgorithm
(
x509Cert
.
SignatureAlgorithm
)
,
SignatureAlgorithm
:
sm2
.
S
M2WithSM3
,
PublicKeyAlgorithm
:
sm2
.
PublicKeyAlgorithm
(
x509Cert
.
PublicKeyAlgorithm
),
PublicKeyAlgorithm
:
sm2
.
PublicKeyAlgorithm
(
x509Cert
.
PublicKeyAlgorithm
),
PublicKey
:
x509Cert
.
PublicKey
,
PublicKey
:
x509Cert
.
PublicKey
,
...
...
plugin/dapp/privacy/crypto/onetimeed25519.go
View file @
cf216df2
...
@@ -16,7 +16,7 @@ import (
...
@@ -16,7 +16,7 @@ import (
type
oneTimeEd25519
struct
{}
type
oneTimeEd25519
struct
{}
func
init
()
{
func
init
()
{
crypto
.
Register
(
privacytypes
.
SignNameOnetimeED25519
,
&
oneTimeEd25519
{})
crypto
.
Register
(
privacytypes
.
SignNameOnetimeED25519
,
&
oneTimeEd25519
{}
,
false
)
}
}
func
(
onetime
*
oneTimeEd25519
)
GenKey
()
(
crypto
.
PrivKey
,
error
)
{
func
(
onetime
*
oneTimeEd25519
)
GenKey
()
(
crypto
.
PrivKey
,
error
)
{
...
...
plugin/dapp/privacy/crypto/ring_signature_crypto.go
View file @
cf216df2
...
@@ -21,7 +21,7 @@ import (
...
@@ -21,7 +21,7 @@ import (
)
)
func
init
()
{
func
init
()
{
crypto
.
Register
(
privacytypes
.
SignNameRing
,
&
RingSignED25519
{})
crypto
.
Register
(
privacytypes
.
SignNameRing
,
&
RingSignED25519
{}
,
false
)
crypto
.
RegisterType
(
privacytypes
.
SignNameRing
,
privacytypes
.
RingBaseonED25519
)
crypto
.
RegisterType
(
privacytypes
.
SignNameRing
,
privacytypes
.
RingBaseonED25519
)
}
}
...
...
plugin/dapp/privacy/wallet/privacybizpolicy_test.go
View file @
cf216df2
...
@@ -149,11 +149,11 @@ func (mock *testDataMock) importPrivateKey(PrivKey *types.ReqWalletImportPrivkey
...
@@ -149,11 +149,11 @@ func (mock *testDataMock) importPrivateKey(PrivKey *types.ReqWalletImportPrivkey
return
return
}
}
pub
,
err
:=
bipwallet
.
PrivkeyToPub
(
cointype
,
privkeybyte
)
pub
,
err
:=
bipwallet
.
PrivkeyToPub
(
cointype
,
uint32
(
signType
),
privkeybyte
)
if
err
!=
nil
{
if
err
!=
nil
{
return
return
}
}
addr
,
err
:=
bipwallet
.
PubToAddress
(
cointype
,
pub
)
addr
,
err
:=
bipwallet
.
PubToAddress
(
pub
)
if
err
!=
nil
{
if
err
!=
nil
{
return
return
}
}
...
...
plugin/dapp/ticket/wallet/ticket_test.go
View file @
cf216df2
...
@@ -278,3 +278,8 @@ func (_m *walletOperateMock) WaitTx(hash []byte) *types.TransactionDetail {
...
@@ -278,3 +278,8 @@ func (_m *walletOperateMock) WaitTx(hash []byte) *types.TransactionDetail {
func
(
_m
*
walletOperateMock
)
WaitTxs
(
hashes
[][]
byte
)
[]
*
types
.
TransactionDetail
{
func
(
_m
*
walletOperateMock
)
WaitTxs
(
hashes
[][]
byte
)
[]
*
types
.
TransactionDetail
{
return
nil
return
nil
}
}
// GetCoinType provides a mock function with given fields:
func
(
_m
*
walletOperateMock
)
GetCoinType
()
uint32
{
return
0
}
plugin/dapp/x2ethereum/ebrelayer/relayer/ethereum/ethereum_test.go
View file @
cf216df2
...
@@ -28,7 +28,7 @@ import (
...
@@ -28,7 +28,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/
influxdata/influxdb/pkg/testing
/assert"
"github.com/
stretchr/testify
/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
)
)
...
...
plugin/mempool/para/base.go
View file @
cf216df2
...
@@ -51,6 +51,7 @@ func (mem *Mempool) SetQueueClient(client queue.Client) {
...
@@ -51,6 +51,7 @@ func (mem *Mempool) SetQueueClient(client queue.Client) {
reply
,
err
=
mem
.
mainGrpcCli
.
GetProperFee
(
context
.
Background
(),
&
types
.
ReqProperFee
{})
reply
,
err
=
mem
.
mainGrpcCli
.
GetProperFee
(
context
.
Background
(),
&
types
.
ReqProperFee
{})
default
:
default
:
msg
.
Reply
(
client
.
NewMessage
(
mem
.
key
,
types
.
EventReply
,
types
.
ErrActionNotSupport
))
msg
.
Reply
(
client
.
NewMessage
(
mem
.
key
,
types
.
EventReply
,
types
.
ErrActionNotSupport
))
continue
}
}
if
err
!=
nil
{
if
err
!=
nil
{
msg
.
Reply
(
client
.
NewMessage
(
mem
.
key
,
types
.
EventReply
,
err
))
msg
.
Reply
(
client
.
NewMessage
(
mem
.
key
,
types
.
EventReply
,
err
))
...
...
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