Jump to content

Angus Robertson

Members
  • Content Count

    2069
  • Joined

  • Last visited

  • Days Won

    38

Posts posted by Angus Robertson


  1. If you have already parsed the XML, and can compose the exact signed content, the ICS function IcsAsymVerifyDigest will verify with a private key and the hash digest, there are other function to create the digest with a private key and for HMAC signing with a shared secret. 

     

    ICS will only work with specific OpenSSL versions it understands, and currently supports three major version, soon to be four when OpenSSL 3.0 enters beta next month.

     

    You could probably embed the DLLs as a resource, unpack to tempdir and open them there, but I'm not planning anything like that.

     

    There is an open source code signing project using OpenSSL https://github.com/mtrojnar/osslsigncode but it's 5,000 lines of C code and not trivial, Microsoft has made code signing quite complicated.  If anyone has built a Windows binary, I'd love to play with it.

     

    Angus

     


  2. I'd need to do more reading on XAdES to see what real cryptography is involved, but I've just finished updating the ICS Jose unit to handle signing and verification using JWK, JWS and JWT which involves hash digests, private and public RSA/EC keys and is used for REST APIs like Let's Encrypt, Google and Microsoft.  Anything using XML will be an older generation and should be easy to support in ICS, if there is a demand. 

     

    Angus

     


  3. I made a mistake word wrapping one of the bad certificates and lost a character, when corrected it reads correctly with ICS and OpenSSL.

     

    It is frustrating OpenSSL does not handle unwrapped certificates consistently and I've raised that as an issue.

     

    But Michal can fix his original problem by ensuring the files are created according to the RFC with 64 character long lines, they are from some source other than ICS.   In theory I could word wrap them, but I think I'll just add a better error if OpenSSL fails. 

     

    Angus

     

     


  4. The original certificates are unwrapped base64 and that is how I tested them. however I manually line wrapped them for the OpenSSL mailing list since email does like 2,500 long lines. 

     

    When I rest them line wrapped, my latest ICS says 'Reading X509 Base64 certificate: Error Cert 1 - error:09091064:PEM routines:PEM_read_bio_ex:bad base64 decode' for the bad certificate and the asn1parase command works for the OK certificate and gives a real error for the bad one.

     

    I'll fix ICS to reject unwrapped certificates since OpenSSL can not reliably handle them. 

     

    Angus


  5. Is it okay to put your SSL certificates in the OpenSSL mailing list, to try and find out why some can not be read? 

     

    I've improved the reading of certificate files and bundles to get some meaningful errors, rather than stack error.  For instance if I remove some lines of base64, I get  'Error Cert 4 - error:0D07209B:asn1 encoding routines:ASN1_get_object:too long' and more ASN1 errors, but reading your bad certificates just says 'Error Cert 1 - error:00000000:lib(0):func(0):reason(0)' which essentially means no error found. 

     

    Angus

     


  6. Probably the certificate files are incorrectly formatted but previously the error was ignored, and this is corrected. 

     

    There is a web site that parses ASN1 https://lapo.it/asn1js/ and it reads all the files OK, but that does not mean they are valid X509 certificates. 

     

    ICS is not the only server using OpenSSL 1.1.1, Certum should make their certificates are compatible with the latest and greatest or others will complain as well. 

     

    Angus

     


  7. OpenSSL 1.1.0 is also old and no longer supported, you should be using 1.1.1g from http://wiki.overbyte.eu/wiki/index.php/ICS_Download which is the latest, but is unlikely to make much difference to certificate errors. 

     

    I am currently making certificate reading more robust, but the offending certificates in the bundles have been there a long time so there is no clear reason why we are now seeing errors on just a few PCs. 

     

    Angus

     


  8. The problem being discussed here is PEM certificate files with extra content outside the base64 blocks, where there may be text outside the 7-bit ASCII range, and something gets confused deciding whether this is UTF8 or ANSI, not quite sure what yet,  or why the new Windows 10 force UTF8 APIs setting would have any effect on content embedded in a De[phi application and not being read from a file. 

     

    So unless your XAdES file has extra stuff you did not post, it's not this issue.

     

    ICS currently supports three versions of OpenSSL with two different DLL names,  If you set the global GSSLEAY_DLL_IgnoreNew to true before calling any SSL functions, it will load the old unsupported libeay32.dll instead of the modern one, and it's possible they do not understand UTF8 so work for you.  But Indy still uses the older DLLs, so confused as to why removing the new ones will upset it.  

     

    There is another global variable GSSL_DLL_DIR you can set to the directory from which to load OpenSSL DLLs, again set before calling anything, needs trailing backslash.

     

    Angus


  9. There is a fix for the internal root certificate bundle in SVN, I simply suppressed literal comments from the constants which saves space in binaries and avoids any 8-bit characters being read.   I added a button in the PemTool sample that loads and displays the various ICS bundles, to make sure they work. 

     

    I need to look more closely at the various functions in ICS that save and read certificates to make sure they all support UTF8, and so that only real base64 PEM content is sent to OpenSSL to avoid any problems reading existing files, not just roots.  That will all need careful testing. 

     

    Angus

     

×