-\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
return pubKeyParams;
}
- ECPoint q = new FpPoint(curve.Curve, pubKeyParams.Q.X, pubKeyParams.Q.Y, false);
+ var q = new FpPoint(curve.Curve, pubKeyParams.Q.X, pubKeyParams.Q.Y, false);
return new ECPublicKeyParameters(q, domain);
}
/// <param name="sigHash">Data hash</param>
/// <param name="signature">Signature bytes</param>
/// <returns>Checking result</returns>
- public bool VerifySignature(Hash256 sigHash, IEnumerable<byte> signature)
+ public bool VerifySignature(Hash sigHash, byte[] signature)
{
- ISigner signer = SignerUtilities.GetSigner("SHA-256withECDSA");
+ var signer = SignerUtilities.GetSigner("NONEwithECDSA");
signer.Init(false, _Public);
- signer.BlockUpdate(sigHash.hashBytes, 0, sigHash.hashSize);
+ signer.BlockUpdate(sigHash, 0, sigHash.hashSize);
- return signer.VerifySignature(signature.ToArray());
+ return signer.VerifySignature(signature);
}
/// <summary>
/// <returns>New key ID</returns>
public CKeyID KeyID
{
- get { return new CKeyID(Hash160.Compute160(PublicBytes)); }
- }
-
- /// <summary>
- /// PublicBytes part of key pair
- /// </summary>
- public IEnumerable<byte> PublicBytes
- {
- get { return _Public.Q.GetEncoded(); }
+ get { return new CKeyID(Hash160.Compute160(_Public.Q.GetEncoded())); }
}
/// <summary>