forked from TrueCloudLab/frostfs-api-go
Implement new request signing mechanism
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
59858805a8
commit
6191903326
9 changed files with 904 additions and 64 deletions
26
util/signature/options.go
Normal file
26
util/signature/options.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
package signature
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
|
||||
crypto "github.com/nspcc-dev/neofs-crypto"
|
||||
)
|
||||
|
||||
type cfg struct {
|
||||
signFunc func(key *ecdsa.PrivateKey, msg []byte) ([]byte, error)
|
||||
verifyFunc func(key *ecdsa.PublicKey, msg []byte, sig []byte) error
|
||||
}
|
||||
|
||||
func defaultCfg() *cfg {
|
||||
return &cfg{
|
||||
signFunc: crypto.Sign,
|
||||
verifyFunc: crypto.Verify,
|
||||
}
|
||||
}
|
||||
|
||||
func SignWithRFC6979() SignOption {
|
||||
return func(c *cfg) {
|
||||
c.signFunc = crypto.SignRFC6979
|
||||
c.verifyFunc = crypto.VerifyRFC6979
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue