Word removing digital signature

C

CraigB

Hi all,

I have a Word document (nb doc not dot) that is signed with a digitial
signature (real one not selfcert) but I'm getting reports that in some
instances when the document is saved (either manually or with autosave)
this error message is coming up:

You have modified a signed project. You do not have the correct key to
sign this project. The signature will be discarded.

So it would appear that somehow the VB project in my document is
becoming 'dirty' so when the save event happens because the user
doesn't have the certificate it's being stripped by Word, which is
obviously a fairly significant problem.

Things is I've no idea what is happening to cause this (my users aren't
touching the VBE). There's no code that should be affecting the
project, the closest I might get is the creation of toolbars but since
it's a doc file they're only getting added to Normal.dot. I've removed
any references to other libraries and none of the forms use ActiveX
controls other than the default set.

So far I've found no way to reliably replicate the problem so I don't
believe it's a problem with a specific line of code but more a
confluence of events. I've found it very difficult to replicate the
problem myself so could the client environment be a factor in some way?
My closest wild guess is something to do with the pasting from the
clipboard but how that could affect the VB project I've no idea.

Any hints on this whatsover would be most appreciated, or even how I
might even go about narrowing down the problem.

TIA

Craig

NB This is happening with Word 2003. I know Word2K had a recognised bug
like this that was fixed with SP3
 
D

Doug Robbins - Word MVP

If the users are modifying the document, then it will be considered by Word
as well to have been changed. You should be distributing a template (.dot)
that users then create documnets from by selecting New from the File menu.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
C

CraigB

But modifying the document content is not the same as modifying the VB
project.
It's not like every time a user edits a document it produces this
problem, only occasionally.

Is Word just getting confused somehow?

My distribution model prevents me from using templates anyway.

Cheers

Craig
 
J

Jonathan West

CraigB said:
But modifying the document content is not the same as modifying the VB
project.
It's not like every time a user edits a document it produces this
problem, only occasionally.

Unless you can get a reliable repro case, nobody here is going to be able to
help much. "Sometimes it deosn't work" the the most useless bug report
imaginable - as you have discovered.

But I will say that Word 2000, even with all service packs installed, as far
as I can tell will discard a VBA signature if the body of the document is
modified, even if the VBA editor is not even opened. Word 2003 mostly
doesn't discard the signature, but I would hate to be reliant on such
behavior in an application delivered to other people.

The best way to reduce the scope for unexpected changes is to reduce as far
as possible the scope for changes altogether. That means putting your code
into a container that is *not* modified by the user.
Is Word just getting confused somehow?

Possibly. Word does get confused, and it is advisable to act in a way that
reduces the scope for such confusion.
My distribution model prevents me from using templates anyway.

Then change it.

If you would like to describe in general terms what you are trying to
achieve and why you made the design choices you have, then I'm sure people
would be able to suggest alternative approaches that might work better for
you.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
C

CraigB

The best way to reduce the scope for unexpected changes is to reduce as far
as possible the scope for changes altogether. That means putting your code
into a container that is *not* modified by the user.

Such as? I don't see how it can be protected any further. It's not the
user themselves who is changing the code - the project is locked - but
Word or through some action my own code.
Possibly. Word does get confused, and it is advisable to act in a way that
reduces the scope for such confusion.

Again I'd be interested in hearing what these ways are.
If you would like to describe in general terms what you are trying to
achieve and why you made the design choices you have, then I'm sure people
would be able to suggest alternative approaches that might work better for
you.

Well OK but I highly doubt there are any alternatives. The documents
are to be uploaded and downloaded from a website - hence why ideally
need a certificate. I've no control over the users as anyone can
subscribe to the site and access the files. I need to control what
files are created/downloaded and they need to have a certain level of
protection to limit their use outside of our system. I also want to be
able to upgrade the code base to fix bugs etc. The only solution for
this I can see is to have each file be self-contained (yes it's a big
pain having lots of code bases to maintain) but it's the only way to
meet the requirements.

I wouldn't say my code is particularly any more complicated or even
that much different from other projects I have done and never had this
problem before. The only real differentiating factor would be that I've
been able to use templates before.

Would there be any merit to creating new doc files? Since the files
contain a lot of styles and content I've been reusing the same binary
files basically since the project's inception several months ago.

TIA

Craig
 
J

Jonathan West

CraigB said:
Such as? I don't see how it can be protected any further. It's not the
user themselves who is changing the code - the project is locked - but
Word or through some action my own code.

By not making any changes at all to the document that contains the code.
Create a new document based on the template, and modify that. If the
template code needs to be updated, then the template itself can be replaced,
and any documents based on it will automatically link to the new template,
provided it has th name name and location as the old one.
Again I'd be interested in hearing what these ways are.

By not making any deliberate modification of the template that contains the
code.
Well OK but I highly doubt there are any alternatives. The documents
are to be uploaded and downloaded from a website - hence why ideally
need a certificate. I've no control over the users as anyone can
subscribe to the site and access the files. I need to control what
files are created/downloaded and they need to have a certain level of
protection to limit their use outside of our system. I also want to be
able to upgrade the code base to fix bugs etc. The only solution for
this I can see is to have each file be self-contained (yes it's a big
pain having lots of code bases to maintain) but it's the only way to
meet the requirements.

You've described the mechanism by which you distribute the code, but haven't
told me anything about what the code is trying to do. It's the latter that I
need to know something about if I'm going to be able to suggest an
alternative approach.
I wouldn't say my code is particularly any more complicated or even
that much different from other projects I have done and never had this
problem before. The only real differentiating factor would be that I've
been able to use templates before.

Would there be any merit to creating new doc files? Since the files
contain a lot of styles and content I've been reusing the same binary
files basically since the project's inception several months ago.

Yes, definitely there would, particularly if you have performed multiple
edits and updates to the code itself. Template bloat causing apparently
random invalid page fault errors is a well-documented phenomenon.

Combatting Template Bloat
http://www.word.mvps.org/FAQs/MacrosVBA/TemplateBloat.htm


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top