I used the following code from the Windows SDK to digitally sign Word Documents but When I open the Signed documents in Word, Word is complaining it can't verify the Signatures and I notices that the Package folder and relatinonship entries are different when using the Word UI to digitally sign a document compared to using the Packaging API, is there anything different that needs to be done compared to the code below from the June CTP of the Windows SDK ?
private void Sign(Package package)
if (package == null)
throw new ArgumentNullException("SignAllParts(package)");
// Create the DigitalSignature Manager
PackageDigitalSignatureManager dsm =
Uri uriPartSignatureOriginRelationship = PackUriHelper.CreatePartUri(
I've just tried your code and it works for me. I didn't add your _digitalSignatureUri to the list of parts to sign. It is different from how Word signs your document though, the signature created using the packaging API freezes the Word UI because the signed file shouldn't be modified.
I'll try and find out more details on this.
Sorry for replying so late to this. This was a bug in the Packaging API code. It's been fixed for the RTM build. Office is looking for the time detail Krishna mentioned in his reply.
It was based on July CTP build of Vista (5472.5 / 4306), I will try the Code in the RTM build and get back on the result.