From 67ff996dc35b245e5ac5e2db86ee35adac8761f6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Sat, 4 Jun 2022 16:46:03 +0300 Subject: [PATCH] Revert "[#261] session: Make failed `Sign` pure on failed signature calculation" This reverts commit 458c882ff4f99874ead0718054fd6a8fdae92969. If `issuerSet` is set after signature calculation then issuer ID isn't written to signed data, in other words not signed. Signed-off-by: Leonard Lyubich --- session/common.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/session/common.go b/session/common.go index 751a65f..0eb6254 100644 --- a/session/common.go +++ b/session/common.go @@ -157,6 +157,7 @@ func (x commonData) signedData(w contextWriter) []byte { func (x *commonData) sign(key ecdsa.PrivateKey, w contextWriter) error { user.IDFromKey(&x.issuer, key.PublicKey) + x.issuerSet = true var sig neofscrypto.Signature @@ -165,8 +166,6 @@ func (x *commonData) sign(key ecdsa.PrivateKey, w contextWriter) error { return err } - x.issuerSet = true - sig.WriteToV2(&x.sig) x.sigSet = true