-\feffusing System.Collections.Generic;
-using System.Linq;
+\feff/**
+ * Novacoin classes library
+ * Copyright (C) 2015 Alex D. (balthazar.ad@gmail.com)
-using Org.BouncyCastle.Crypto;
-using Org.BouncyCastle.Crypto.Parameters;
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+using Org.BouncyCastle.Asn1.Sec;
using Org.BouncyCastle.Asn1.X9;
+using Org.BouncyCastle.Crypto;
+using Org.BouncyCastle.Crypto.Parameters;
+using Org.BouncyCastle.Math.EC;
using Org.BouncyCastle.Security;
-using Org.BouncyCastle.Asn1.Sec;
-using Org.BouncyCastle.Math.EC;
+using System.Collections.Generic;
+using System.Linq;
namespace Novacoin
/// <summary>
/// Does the signature matches our public key?
/// </summary>
- /// <param name="data">Data bytes</param>
+ /// <param name="sigHash">Data hash</param>
/// <param name="signature">Signature bytes</param>
/// <returns>Checking result</returns>
- public bool VerifySignature(IEnumerable<byte> data, IEnumerable<byte> signature)
+ public bool VerifySignature(Hash sigHash, IEnumerable<byte> signature)
{
- byte[] dataBytes = data.ToArray();
-
- ISigner signer = SignerUtilities.GetSigner("SHA-256withECDSA");
+ ISigner signer = SignerUtilities.GetSigner("NONEwithECDSA");
signer.Init(false, _Public);
- signer.BlockUpdate(dataBytes, 0, dataBytes.Length);
+ signer.BlockUpdate(sigHash.hashBytes, 0, sigHash.hashSize);
return signer.VerifySignature(signature.ToArray());
}