-\feffusing System.Collections.Generic;
-using System.Linq;
-using System;
+\feff/**
+ * Novacoin classes library
+ * Copyright (C) 2015 Alex D. (balthazar.ad@gmail.com)
-using Org.BouncyCastle.Math;
-using Org.BouncyCastle.Math.EC;
+ * 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.Crypto;
using Org.BouncyCastle.Crypto.Generators;
using Org.BouncyCastle.Crypto.Parameters;
+using Org.BouncyCastle.Math;
+using Org.BouncyCastle.Math.EC;
using Org.BouncyCastle.Security;
+using System;
+using System.Collections.Generic;
+using System.Linq;
namespace Novacoin
/// <summary>
/// Create signature for supplied data
/// </summary>
- /// <param name="data">Data bytes sequence</param>
+ /// <param name="data">Hash to sigh</param>
/// <returns>Signature bytes sequence</returns>
- public IEnumerable<byte> Sign(IEnumerable<byte> data)
+ public IEnumerable<byte> Sign(Hash sigHash)
{
- byte[] dataBytes = data.ToArray();
-
- ISigner signer = SignerUtilities.GetSigner("SHA-256withECDSA");
+ ISigner signer = SignerUtilities.GetSigner("NONEwithECDSA");
signer.Init(true, _Private);
- signer.BlockUpdate(dataBytes, 0, dataBytes.Length);
+ signer.BlockUpdate(sigHash.hashBytes, 0, sigHash.hashSize);
return signer.GenerateSignature();
}