8000 Bugfix: Need to pay attention to signature size · openssl-net/openssl-net@82e1079 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 82e1079

Browse files
author
Adam Caudill
committed
Bugfix: Need to pay attention to signature size
1 parent 2436934 commit 82e1079

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/TestECDSA.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@
2323
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2424
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525

26-
using System;
2726
using NUnit.Framework;
2827
using OpenSSL.Core;
29-
using Random = OpenSSL.Core.Random;
30-
using System.Runtime.InteropServices;
3128
using OpenSSL.Crypto;
32-
using System.Text;
3329
using OpenSSL.Crypto.EC;
30+
using System;
31+
using System.Text;
32+
using Random = OpenSSL.Core.Random;
3433

3534
namespace UnitTests
3635
{
@@ -133,11 +132,13 @@ public void test_builtin() {
133132

134133
/* create signature */
135134
byte[] signature = new byte[eckey.Size];
136-
eckey.Sign(0, digest, signature);
135+
var sigSize = eckey.Sign(0, digest, signature);
136+
Array.Resize(ref signature, (int)sigSize);
137137
Console.Write(".");
138138

139139
/* verify signature */
140-
Assert.IsTrue(eckey.Verify(0, digest, signature));
140+
var verifyResult = eckey.Verify(0, digest, signature);
141+
Assert.IsTrue(verifyResult);
141142
Console.Write(".");
142143

143144
/* verify signature with the wrong key */
@@ -155,4 +156,3 @@ public void test_builtin() {
155156
}
156157
}
157158
}
158-

0 commit comments

Comments
 (0)
0