Author: Matt Whitlock 2015-01-22 04:18:07
Published on: 2015-01-22T04:18:07+00:00
The first part of the context discusses a proposal to change the parameters of C++ functions from (const std::vector &sig, size_t &off) to (std::vector::const_iterator &itr, std::vector::const_iterator end) in order to be more in line with the C++ spirit. This is followed by a discussion on the risks of depending on OpenSSL for consensus rules and the need for a fundamental solution for it sooner rather than later. The post then suggests an example code for validating signatures encoded according to DER format. The example code provided includes multiple functions that validate different parts of the signature and provide detailed commentary explaining how each element should be validated. The code is lengthy but provides test cases that can be used for validation purposes. It defines various types of signatures with varying lengths and values, including normal, minimal, and maximal length signatures, as well as zero-padded signatures. The 'check' function takes a vector of signatures as an argument and returns true if it's valid, otherwise false. The function first fixes the length of the signature and then checks its validity using 'IsValidSignatureEncoding' function. The static vectors defined in the code contain different types of signatures and are passed through the check function to see if they're valid or not. The assert function is used to validate the result of the check function. In addition, the code defines different types of error cases, such as invalid signature lengths, non-integer values, missing sighash, and extra bytes. The vectors containing these error cases are also passed through the check function to ensure that they fail validation. The main function calls all the good and bad test cases to check if the check function is working correctly or not.Lastly, the context ends with a promotional message from GigeNET about their new data center in Ashburn, VA.
Updated on: 2023-06-09T15:44:58.125994+00:00