Document the non-DER-conformance of one test in tx_valid.json. #10679

pull schildbach wants to merge 1 commits into bitcoin:master from schildbach:tx-valid-comment changing 1 files +1 −1
  1. schildbach commented at 6:42 AM on June 27, 2017: contributor

    It contains a non-DER-conformant ASN1 integer as a signature: 0xffda47bfc776bcd269da4832626ac332adfca6dd835e8ecd83cd1ebe7d709b0e

  2. fanquake added the label Docs and Output on Jun 27, 2017
  3. fanquake added the label Tests on Jun 27, 2017
  4. gmaxwell commented at 7:14 PM on June 27, 2017: contributor

    Please document how it's not DER conformant too.

  5. schildbach commented at 1:51 PM on June 28, 2017: contributor

    Here is the code in BouncyCastle that checks ASN1 integers. How would you describe this code? Check if it's a "Two's complement"?

                if (bytes[0] == 0 && (bytes[1] & 0x80) == 0)
                {
                    throw new IllegalArgumentException("malformed integer");
                }
                if (bytes[0] == (byte)0xff && (bytes[1] & 0x80) != 0)
                {
                    throw new IllegalArgumentException("malformed integer");
                }
    
  6. laanwj commented at 10:10 AM on June 29, 2017: member

    secp256k1 calls it "Excessive 0xFF padding" (and if it would pass that one, it's also negative) https://github.com/bitcoin-core/secp256k1/blob/master/src/ecdsa_impl.h#L120

    So it's DER conformant just not strict DER conformant?

  7. gmaxwell commented at 7:02 PM on June 30, 2017: contributor

    I think I would just call it negative. It's perfectly valid to encode negative numbers in DER but they don't make sense in signatures-- so for some inexplicable reason OpenSSL just ignored the sign.

  8. Document the non-strict-DER-conformance of one test in tx_valid.json.
    In a signature, it contains an ASN1 integer which isn't strict-DER conformant due to excessive 0xff padding:
    0xffda47bfc776bcd269da4832626ac332adfca6dd835e8ecd83cd1ebe7d709b0e
    c1c845e827
  9. schildbach force-pushed on Jun 30, 2017
  10. schildbach commented at 7:31 PM on June 30, 2017: contributor

    Thanks, I changed the wording and added a reference to BIP66. What I don't understand is why this test is in tx_valid.json and not in tx_invalid.json. BIP66 declares such sigs as invalid. Or do the tests run pre-BIP66?

  11. sipa commented at 7:50 PM on June 30, 2017: member

    Each test specifies its own flags. If nothing is specified, the flags are 0, I believe. So no BIP66 rules in this test.

  12. laanwj referenced this in commit 31b2612bbf on Aug 23, 2017
  13. laanwj commented at 10:16 AM on August 23, 2017: member

    Merged via 31b2612bbf199fcbbb242fc1cfa2ad6221b0dcc7 (changed "excessive 0xff" in the description to "negative" per @gmaxwell)

  14. laanwj closed this on Aug 23, 2017

  15. PastaPastaPasta referenced this in commit 318a051b42 on Sep 19, 2019
  16. PastaPastaPasta referenced this in commit 6c91194a86 on Sep 19, 2019
  17. PastaPastaPasta referenced this in commit 6dd38458f4 on Sep 23, 2019
  18. PastaPastaPasta referenced this in commit a04c0cb3a4 on Sep 24, 2019
  19. PastaPastaPasta referenced this in commit dcb49a1a7a on Nov 19, 2019
  20. PastaPastaPasta referenced this in commit 8c149cb132 on Nov 21, 2019
  21. PastaPastaPasta referenced this in commit 1e2506c3a1 on Dec 9, 2019
  22. PastaPastaPasta referenced this in commit 2746b92039 on Jan 1, 2020
  23. PastaPastaPasta referenced this in commit 24096fb60a on Jan 2, 2020
  24. PastaPastaPasta referenced this in commit e58fed348f on Jan 2, 2020
  25. ckti referenced this in commit 82dd338e91 on Mar 28, 2021
  26. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-22 18:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me