• Michael Stahl's avatar
    tdf#114939 package,comphelper: Try both real SHA1 and StarOffice SHA1 · 9188ea83
    Michael Stahl yazdı
    ... when importing ODF documents.
    
    In CreatePackageEncryptionData(), add a 3rd SHA1 password hash,
    PackageSHA1CorrectEncryptionKey, to EncryptionData.
    
    Use it in ZipPackageStream::getDataStream(), which has 3 fall-backs
    for SHA1 bugs now.
    
    Also add a CorrectSHA1DigestContext, to be used together with
    PackageSHA1CorrectEncryptionKey, and rename the existing one to
    StarOfficeSHA1DigestContext, to be used together with the existing
    2 PackageSHA1{UTF8,MS1252}EncryptionKey.
    
    The fallback won't be used very often anyway: for the password SHA1
    to be wrong, you need a password between 52 and 55 bytes long,
    and for the SHA1/1K checksum to be wrong, you need a file
    smaller than 1K with compressed size mod 64 between 52 and 55;
    all XML files have enough random "chaff" added to be too large.
    
    Test that we can read both correct SHA1 and StarOffice SHA1.
    
    Change-Id: I988fa489b5e40c7657f404f18538f637d54d28f1
    9188ea83
EncryptionData.hxx 2.66 KB