none
Macro is signed or unsigned digitally? RRS feed

  • Question

  • Hi,

    Do we have a way to know or differentiate whether a MS Word macro is digitally signed or unsigned?

     

    Thanks

    Uttam

    Monday, December 5, 2011 10:47 AM

Answers

  • Hi Uttam

    I was going to write a long, involved way to figure it out, but found the following just as I was getting started. This is Word 2007 BTW. I don't know when the property was introduced:

      DocumentObject.VBASigned

    will return a boolean value. True if the project is signed; false if it's not. Note that digital signing applies to the entire document, not an individual macro.

    For a closed document, I imagine this property is also saved in the file's OpenXML.


    Cindy Meister, VSTO/Word MVP
    • Proposed as answer by JosephFox Wednesday, December 14, 2011 2:48 PM
    • Marked as answer by Bruce Song Tuesday, December 20, 2011 3:04 AM
    Thursday, December 8, 2011 10:38 AM
    Moderator

All replies

  • I'm not really sure, but I don't think macros themselves, in the sense of MS Office macros, would be able to be signed. Macros would be encorporated into an Add-in (with its installer), or macro-enabled template, which would then be signed. So, I think it depends how you're packaging your macros.
    Tuesday, December 6, 2011 12:54 PM
  • Hi Joseph

    Not  that it helps with the original question, but...

    <<but I don't think macros themselves, in the sense of MS Office macros, would be able to be signed>>

    It's possible to digitally sign the VBA Project of an Office document (VBA Editor: Tools/Digital Signature).

    This is different from digitally signing the document, itself.

    However, I don't know if there's any way to ascertain whether the VBA project is digitally signed... Certainly, there's nothing in the object model.


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Uttam_D Thursday, December 8, 2011 7:19 AM
    • Unmarked as answer by Uttam_D Thursday, December 8, 2011 7:19 AM
    Tuesday, December 6, 2011 8:46 PM
    Moderator

  • However, I don't know if there's any way to ascertain whether the VBA project is digitally signed... Certainly, there's nothing in the object model.

    Thanks Cindy. It answers my query. It leads us to statement that we don't have a way to ensure, before running a macro programatically, whether its digitally signed or not". Right?

    Regards

    Uttam

    Thursday, December 8, 2011 7:22 AM
  • Hi Uttam

    I was going to write a long, involved way to figure it out, but found the following just as I was getting started. This is Word 2007 BTW. I don't know when the property was introduced:

      DocumentObject.VBASigned

    will return a boolean value. True if the project is signed; false if it's not. Note that digital signing applies to the entire document, not an individual macro.

    For a closed document, I imagine this property is also saved in the file's OpenXML.


    Cindy Meister, VSTO/Word MVP
    • Proposed as answer by JosephFox Wednesday, December 14, 2011 2:48 PM
    • Marked as answer by Bruce Song Tuesday, December 20, 2011 3:04 AM
    Thursday, December 8, 2011 10:38 AM
    Moderator
  • "Note that digital signing applies to the entire document, not an individual macro."

    I just found this Microsoft article and it looks like to me that individual macros can be digitally signed/unsigned. Can you please clarify?

    -Uttam

    Tuesday, December 20, 2011 5:54 AM
  • "Note that digital signing applies to the entire document, not an individual macro."

    I just found this Microsoft article and it looks like to me that individual macros can be digitally signed/unsigned. Can you please clarify?

    Hi Uttam

    I think this article is simply poorly written. It's a blog article, not a KB article, which means no one checks it for inconsistencies or unclear meanings. It appears the author equates the term "macro" with "VBA Project within an Excel file".

    There is no way in any Office document to digitally sign some pieces of code and not others. Either the entire VBA project of a file is signed, or it's not signed.

    The differentiation the article discusses is whether all VBA code, in all files are allowed/blocked vs. being able to allow VBA Code in certain files to run, while blocking it in other files.


    Cindy Meister, VSTO/Word MVP
    Tuesday, December 20, 2011 8:28 AM
    Moderator