I have two, third party assemblies:
Foo.dll
and
ReferencesFoo.dll
As noted, ReferencesFoo.dll
is an assembly that has a reference to Foo.dll
For my application, I ne开发者_StackOverflow社区ed to resign these assemblies. I use ildasm/ilasm in combination along with a signing key to resign them, however, ReferencesFoo.dll
still contains (in it's manifest?) the reference to the Foo.dll
old public key and public key token.
So, how do I sign both dll's with my key, and update the references in ReferencesFoo.dll
without getting the source code and recompiling?
You can easily do that with Mono.Cecil. Open Foo.dll, and save it with your new snk, and update its reference in ReferenceFoo.dll to the appropriate public key token.
You can sign an assembly with the SN.exe tool (using the -R switch to resign an already signed assembly).
But you have to be aware that modifying a third party component might likely be illegal. So make sure there are no legal problems before doing so.
And I'm not aware of any tools to automatically change references. You can find them in the metadatatable #35 which is structured as follows:
- MajorVersion, MinorVersion, BuildNumber, RevisionNumber (2-byte constants)
- Flags (a 4-byte bitmask of type AssemblyFlags)
- PublicKeyOrToken (index into Blob heap – the public key or token that identifies the author of this Assembly)
- Name (index into String heap)
- Culture (index into String heap)
- HashValue (index into Blob heap)
I found this article which demonstrates exactly how to do this.
It involved using sn,ildasm,ilasm, and a text editor.
http://buffered.io/posts/net-fu-signing-an-unsigned-assembly-without-delay-signing
精彩评论