Issue 121505

Summary: Adding a signature to a document already signed by MS Word invalidates the MS Word signature
Product: General Reporter: chris.rae
Component: uiAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Normal    
Priority: P3 CC: chris.rae, issues, orcmid
Version: 3.4.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
File signed by MS Word (result of step 7 in the repro steps)
none
A Leisurely Hello-Again Confirmation [zip] none

Description chris.rae 2012-12-18 18:45:40 UTC
Created attachment 80045 [details]
File signed by MS Word (result of step 7 in the repro steps)

Using OOo to add a signature to a document that has already been signed by someone in MS Word invalidates the (still-valid) original signature.

Steps (note that a file is attached which allows you to skip steps 1-7):

1) Boot MS Word
2) Hit Escape (Create default document)
3) File -> Info -> Protect Document -> Add a Digital signature
4) Save file as ODF format (.odt)
5) Choose an RSA certificate that uses a SHA1 hash (DSA is fine too)
6) Click Sign
7) Exit MS Word
8) Open document in OOo 
9) Under File menu, click Digital Signatures
10) Notice they're considered valid
11) Now click "Sign Document" button and add a digital signature using a SHA1 cert
12) Observe invalid original signature

It seems that this might be happening because OOo is rewriting the XML for the MS Word signature, but omitting the Type attribute on the Reference element.

This is also filed on LibreOffice (https://bugs.freedesktop.org/show_bug.cgi?id=58476)
Comment 1 orcmid 2012-12-19 00:27:24 UTC
Created attachment 80048 [details]
A Leisurely Hello-Again Confirmation [zip]

This is a slow walk through this defect case to gain more clues on what the disconnect is.  There are two ODT documents and a variety of screenshots, in date-time sequence:

 1. HelloAgain.odt is a simple Word 2013 Preview document saved with a digital signature.

 2. SignedFirst.png shows the dialogs that were used in the signing of (1).  Aftersigned.png are two screen shots confirming that signing occurred.  The last shows that signed documents are considered "final" as a safety measure.

 3. HelloAgainInAOO.png shows that a *copy* of HelloAgain.odt, HelloAgain2.odt, is still recognized as signed with a verifiable signature by Apache OpenOffice 3.4.1.  (The renamed copy is to prevent alteration to HelloAgain.odt so it can be compared with later ones.)

 4. AOO-delines.png is fascinating.  AOO 3.4.1 concludes that signatures can't be added because the document does not have an ODF 1.2 digital signature.  (There is no digital signature in ODF 1.1, but OpenOffice.org implementations had an implementation-dependent one that is not compatible with the ODF 1.2 digital signature.  But that is not what is in HelloAgain2.odt.  Hypothesis: This is an unintended consequence of the manifest:version introduction.)

 5. HelloAgainInLibO.png is HelloAgain2.odt opened in LibreOffice 3.6.4 (any port in a storm).  The document is again recognized as having a verifiable signature.

 6. AddSigLibO.png shows that LibreOffice 3.6.4 does allow adding a signature.

 7. Oops!  After applying the second signature, the first signature is reported as invalid.  This is demonstrated in the three OopsLibO.png screen captures.  The last of those is on attempting to re-open the HelloAgain2.odt after the defective second signing. 

 8. OopsAOO.png reveals that Apache OpenOffice 3.4.1 also sees the double-signing as defective.

 9. OopsMSWPre.png also demonstrates that Microsoft Office Word 2013 Preview fails to notice that HelloAgain2.odt is signed at all.  The document is not opened as read-only or final either.

I can see a significant area for work at the next ODF Plugfest [;<).
Comment 2 orcmid 2012-12-19 03:22:09 UTC
I think we've confirmed the symptoms, now need to figure out what and how many the bugs are.