[#93] Remove golang.org/x/crypto dependency

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2021-12-10 16:56:04 +03:00 committed by Alex Vanin
parent a2572a23a3
commit 2806d90089
18 changed files with 97 additions and 144 deletions

View file

@ -2,8 +2,8 @@ package eacl
import (
"crypto/ecdsa"
"crypto/elliptic"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
v2acl "github.com/nspcc-dev/neofs-api-go/v2/acl"
)
@ -51,8 +51,7 @@ func SetTargetECDSAKeys(t *Target, pubs ...*ecdsa.PublicKey) {
}
for i := 0; i < ln; i++ {
b := elliptic.MarshalCompressed(pubs[i].Curve, pubs[i].X, pubs[i].Y)
binKeys = append(binKeys, b)
binKeys = append(binKeys, (*keys.PublicKey)(pubs[i]).Bytes())
}
t.SetBinaryKeys(binKeys)
@ -68,13 +67,9 @@ func TargetECDSAKeys(t *Target) []*ecdsa.PublicKey {
pubs := make([]*ecdsa.PublicKey, ln)
for i := 0; i < ln; i++ {
x, y := elliptic.UnmarshalCompressed(elliptic.P256(), binKeys[i])
if x != nil && y != nil {
pubs[i] = &ecdsa.PublicKey{
Curve: elliptic.P256(),
X: x,
Y: y,
}
p := new(keys.PublicKey)
if p.DecodeBytes(binKeys[i]) == nil {
pubs[i] = (*ecdsa.PublicKey)(p)
}
}