public void PrivateKey_Sign_ReturnsExpectedSignatureDer() { var privateKey = new ECPrivateSecurityService(_privateKey); var messageHash = HashUtil.Blake256(_message); var signature = privateKey.Sign(messageHash).Serialize(); Assert.Equal(_signature, signature); }
public void ECSecurityService_VerifySignature_VerifiesGeneratedSignatureAgainstPublicKey() { const bool isCompressed = false; var messageHash = HashUtil.Blake256(_message); var signature = new ECSignature(_signature); var privateSecurityService = new ECPrivateSecurityService(_privateKey); var publicKeyBytes = privateSecurityService.GetPublicKey(isCompressed); var publicSecurityService = new ECPublicSecurityService(publicKeyBytes); var hasValidSignature = publicSecurityService.VerifySignature(messageHash, signature); Assert.True(hasValidSignature); }
public PrivateKey(byte[] secret) { _ecPrivateSecurityService = new ECPrivateSecurityService(secret); Secret = secret; }