forked from TrueCloudLab/frostfs-sdk-go
[#93] Remove golang.org/x/crypto dependency
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
a2572a23a3
commit
2806d90089
18 changed files with 97 additions and 144 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue