• Michael Stahl's avatar
    tdf#115483 svl xmloff sc sw: verify all ODF 1.2 protection-key hashes · 398275ba
    Michael Stahl yazdı
    ODF 1.2 has added some mandatory requirements for protection-key hashes
    which did not exist in ODF 1.1.
    
    This affects sections and indexes in ODT documents, as well as
    spreadsheets and sheets in ODS documents.
    
    1. Accept the following hashed passwords:
        * UTF16 LE/BE encoded StarOffice-SHA1, OOo legacy and allowed by ODF 1.1
        * UTF8 encoded proper SHA1, as required by ODF 1.2
        * UTF8 encoded SHA256, as required by ODF 1.2
            - specified either with the wrong URL used in the ODF 1.2 spec
              or the correct URL from the W3C spec, see OFFICE-3702
        * Excel+SHA1 double-hash, only in Calc, see OFFICE-2112
    
    2. Round-trip any of the above as-is
        * for SHA256 only write the URL from the ODF 1.2 spec
    
    3. Generate only UTF16 LE encoded SHA1 for now, so that older LO
       releases can still verify the password
        * some time in the future, switch to generating some valid ODF 1.2 hash
    
    More changes are necessary in Calc, which can actually preserve
    different hashes for the same passwords in its runtime data model,
    whereas Writer just has a single buffer without even any metadata.
    
    For the Calc unit tests we need one document per hash because the
    protection-key attribute can be set on the entire spreadsheet, which
    is an unique element in the document.
    
    There are further uses of SvlPasswordHelper for change-tracking passwords,
    but apparently those are stored in settings.xml, so ODF has no
    requirements for them, so let's leave that as it is.
    
    Change-Id: Icb720b14ae9c0d9c04d2e082769ae2b74e3af8aa
    Reviewed-on: https://gerrit.libreoffice.org/49352Tested-by: 's avatarJenkins <ci@libreoffice.org>
    Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
    398275ba
CppunitTest_sw_odfexport.mk 1.62 KB