crtsh / certwatch_db

Database schema
https://crt.sh/
GNU General Public License v3.0
199 stars 36 forks source link

https://crt.sh/gen-add-chain not working #90

Closed RufusJWB closed 2 years ago

RufusJWB commented 2 years ago

If I execute https://crt.sh/gen-add-chain with the following PEM file, I receive the error message image

Executing the SQL statement "SELECT public.generate_add_chain_body(@cert_data,@only_one_chain)" with the certificate as a byte array directly on the data base returns an empty result.

The PEM file belongs to https://crt.sh/?id=5815024778

MIIKPDCCCCSgAwIBAgIEYByDszANBgkqhkiG9w0BAQsFADCBmTELMAkGA1UEBhMC
REUxDzANBgNVBAgMBkJheWVybjERMA8GA1UEBwwITXVlbmNoZW4xEDAOBgNVBAoM
B1NpZW1lbnMxETAPBgNVBAUTCFpaWlpaWkExMR0wGwYDVQQLDBRTaWVtZW5zIFRy
dXN0IENlbnRlcjEiMCAGA1UEAwwZU2llbWVucyBSb290IENBIFYzLjAgMjAxNjAe
Fw0yMDA2MjQwOTQ0NTVaFw0yNjA2MjQwOTQ0NTVaMIGfMQswCQYDVQQGEwJERTEP
MA0GA1UECAwGQmF5ZXJuMREwDwYDVQQHDAhNdWVuY2hlbjEQMA4GA1UECgwHU2ll
bWVuczERMA8GA1UEBRMIWlpaWlpaQjIxHTAbBgNVBAsMFFNpZW1lbnMgVHJ1c3Qg
Q2VudGVyMSgwJgYDVQQDDB9TaWVtZW5zIElzc3VpbmcgQ0EgRUUgQXV0aCAyMDIw
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAygO6wQ9MA4AQ5PAjtCRJ
3dvDPApKAxu7NfFQ9qhiwRYICnMZ7h7OH1lnPTTD36VuSJKe4SRa7Bf4U/nQsuSA
/U1SSyKBvC2xnd04N4H8fUZWD7lxXihpYHdGG3l49gUJE7CySniVRLoMaW6cpz63
Y0GQd6wHQRZ6Jol5lImfSAC3ZqMXIRU/bCnBEcJpH9KPCZA98JTWOrC65TT7NLTo
QtF1LysGI3Q9ey1LohujL7eM+k+Uqeu0C6aM7Y1Ox8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hSHd+tIJzWxt3f/14bOQyyBK5jrQYgfJ3C
xlB70kXJEMII75F/PYZe77AqHwQ1C2LrDhTbKBDDZqq0iwVBVANzOqOKx80GQZVI
nKn3JfFrYk6sQ6N13HnId/WlVNTaQ09qHeWJwNChnSYJnHKW5QsnDdEo5aOX0/wD
ZWkgA+pt4mBpaiv78HOTO+1DfJokHk88aUPYYVA0lFw1SlB2kOztwBSTBOiKSvfK
AZVSAiZ8eCGcMNlpgbS3DF5+oDz6H2UNyQAcj5zRUwIMy3hMCfpsWiEBwim+1p9D
4v/6TmFdoEq//+T4RIdqS9m53YMArHDhuywehzUX9Kx7mQY6xtI74e3eKCzu9Vjp
yhphdjRWYyxyslQm2V/JIK82YOnFwmfHGP0/7+HaHNeJA9+OKcSPs/qM1AjY7sKK
TZM9jlctU0aPPnFCsQUswPIojA0t2CFEuHMxKf89ijlupqxn9b3zaVIYY4SvDVek
pUyxELK7NZnWrexBF3q4mKgiJSaPv9X/AcWHiSm9qjigRxDY1Lw1UQEgxG32q31c
SNVdZaIdWF1kK4f8PLQibigrX76zUyMeXkd3kuq2u0o=
robstradling commented 2 years ago

@RufusJWB I expect you're running into the issue described at the bottom of the https://crt.sh/gen-add-chain page... "Please note: This tool currently finds chains that are trusted by the Mozilla and/or Microsoft and/or Apple root programs. FIXME: Look at each log's /ct/v1/get-roots instead"

RufusJWB commented 2 years ago

That's true. Any clever idea how to fix this?

RufusJWB commented 2 years ago

I'll craft the submission chain by hand.

RufusJWB commented 2 years ago

Just in case someone else runs into this problem: I created a simple (very Siemens specific) GIST how to do this effectively. https://gist.github.com/RufusJWB/ed37330e5d023ac7f3bed3c240d34578