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,310 points
165 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,720 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
216 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
170 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,710 points
1,159 views
0 votes
1 answer

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

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,440 points
650 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,008 views
0 votes
1 answer
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,720 points
702 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP