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,040 points
19 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 27,620 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 20, 2018 in Blockchain by Perry
• 16,450 points
18 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
• 16,450 points
9 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
292 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 ariaholic
• 7,320 points
43 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
66 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
• 27,620 points
25 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.