NBitcoin throws InvalidOperationException with the message Mac HMACSHA256 not recognised

0 votes

I got the message when I try to sign a transaction:

Transaction payment = new Transaction();
BitcoinSecret PaymentSecret = new BitcoinSecret("1sXCvdpXz...UqkXW9mvT");
...
payment.Sign(Container.PaymentSecret, false);

I dig into the opensource NBitcoin API and figured out these lines give me the error message. What can I do? (https://github.com/NicolasDorier/NBitcoin/blob/master/NBitcoin/Crypto/DeterministicECDSA.cs)

try
{
    hmac = MacUtilities.GetMac(macName);
}
catch(SecurityUtilityException nsae)
{
    throw new InvalidOperationException(nsae.Message, nsae);
}
Aug 27, 2018 in Blockchain by slayer
• 29,370 points
505 views

1 answer to this question.

0 votes

If someone would like to figure out what is happening exactly, here's a code snippet that'll cause the bug:

    string mechanism = "HMACSHA256";
    if (mechanism.StartsWith("HMAC"))
    {
        Console.WriteLine("good");
    }
    else
    {
        Console.WriteLine("bad");
    }
    Console.ReadLine();

answered Aug 27, 2018 by digger
• 26,740 points

Related Questions In Blockchain

0 votes
1 answer

Is it that new bitcoins gets created with the every block mined??

Bitcoin mining means validation of a block ...READ MORE

answered Apr 21, 2018 in Blockchain by Perry
• 17,100 points
831 views
0 votes
1 answer

Account not listed in the Deploy Contract screen?

You need to get an initial allocated ...READ MORE

answered Jun 4, 2018 in Blockchain by Perry
• 17,100 points
580 views
0 votes
1 answer

Not Able to register a user with Hyperledger-Fabric v1.1 preview

The error: "Certificate not found with AKI 'e729224e8b3f31784c8a93c5b8ef6f4c1c91d9e6e577c45c33163609fe40011' ...READ MORE

answered Jun 16, 2018 in Blockchain by charlie_brown
• 7,720 points
1,899 views
+1 vote
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,460 points
1,459 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,942 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,468 views
0 votes
1 answer

Not receiving any data from the BitStamp API.

I saw a code online that was ...READ MORE

answered Aug 21, 2018 in Blockchain by digger
• 26,740 points
1,329 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP