void convertnoncanonical(std::string const& hex, std::string const& canonhex)
    {
        blob b (loadsignature(hex));

        // the signature ought to at least be valid before we begin.
        expect (isvalid (hex), "invalid signature");

        size_t len = b.size ();

        expect (!makecanonicalecdsasig (&b[0], len),
            "non-canonical signature was already canonical");

        expect (b.size () >= len,
            "canonicalized signature length longer than non-canonical");

        b.resize (len);

        expect (iscanonicalecdsasig (&b[0], len, ecdsa::strict),
            "canonicalized signature is not strictly canonical");

        blob canonicalform (loadsignature (canonhex));

        expect (b.size () == canonicalform.size (),
            "canonicalized signature doesn't have the expected length");

        expect (std::equal (b.begin (), b.end (), canonicalform.begin ()),
            "canonicalized signature isn't what we expected");
    }
示例#2
0
/*
 * Edit signature file, called by menu 319
 */
void signature(void)
{
    memset(&sLiNE, 0, sizeof(sLiNE));

    if (loadsignature()) {
	while (TRUE) {
	    if (editsignature() == TRUE)
		break;
	}
    }

    Enter(2);
    /* Returning to */
    pout(CFG.MoreF, CFG.MoreB, (char *) Language(117));
    poutCR(CFG.MoreF, CFG.MoreB, CFG.bbs_name);
    sleep(2);
}
 // verifies that a signature is syntactically valid and in canonical form.
 bool isstrictlycanonical (std::string const& hex)
 {
     blob j (loadsignature(hex));
     return iscanonicalecdsasig (&j[0], j.size (), ecdsa::strict);
 }