forked from TrueCloudLab/frostfs-sdk-go
[#190] crypto: Start Scheme enum from zero
Enumerate signature schemes of `Scheme` type from 0 in order to sync with NeoFS API protocol by values. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
ea043f4ca3
commit
2f9cc50fec
2 changed files with 5 additions and 10 deletions
|
@ -48,12 +48,7 @@ func (x *Signature) Calculate(signer Signer, data []byte) error {
|
|||
|
||||
m := (*refs.Signature)(x)
|
||||
|
||||
scheme := refs.SignatureScheme(signer.Scheme())
|
||||
if scheme > 0 {
|
||||
scheme-- // to sync numeric values
|
||||
}
|
||||
|
||||
m.SetScheme(scheme)
|
||||
m.SetScheme(refs.SignatureScheme(signer.Scheme()))
|
||||
m.SetSign(signature)
|
||||
m.SetKey(key)
|
||||
|
||||
|
@ -69,7 +64,7 @@ func (x *Signature) Calculate(signer Signer, data []byte) error {
|
|||
func (x Signature) Verify(data []byte) bool {
|
||||
m := (*refs.Signature)(&x)
|
||||
|
||||
f, ok := publicKeys[Scheme(m.GetScheme()+1)] // increment to sync numeric values
|
||||
f, ok := publicKeys[Scheme(m.GetScheme())]
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue