Comments (3)
To add to this, it is also not possible to round trip such assemblies. When loading a delay signed assembly and then directly saving it again, the assemblies will have the "StrongName" flag set in the header, while normally delay signed assemblies do not have the flag set. The same applies to test-signed assemblies.
from dnlib.
I've added a DelaySign option to ModuleWriterOptions that you can use.
Generate the public key:
sn -p mykey.snk mypublickey.snk
Delay sign it:
var file = @"c:\some\path\DelaySigned.exe";
var snPublicKey = new StrongNamePublicKey(@"c:\some\path\mypublickey.snk");
var ctx = ModuleDef.CreateModuleContext();
var mod = ModuleDefMD.Load(file, ctx);
//...
var opts = new ModuleWriterOptions(mod);
opts.DelaySign = true;
opts.StrongNamePublicKey = snPublicKey;
mod.Write(@"c:\some\path\DelaySigned_new.exe", opts);
from dnlib.
Great! Thank you very much. Is there also a property to check if a loaded
assembly is delay signed (ModuleDef) and in this case would the writer be
initialized correctly to roundtrip?
Thanks again!
Edit: Removed remark about public key as this is already handled. Was confused about the .snk ending.
from dnlib.
Related Issues (20)
- Consider adding a net6.0 as an additional target framework HOT 2
- Error CS0246 The type or namespace name 'dnlib' could not be found (perhaps missing a using directive or an assembly reference). HOT 1
- Optimize properties on `TypeRef` and `TypeDef` HOT 3
- Import property without using typeof
- HasOverrides Generic Type HOT 2
- PDB Generated is wrong HOT 7
- Linux R2R mixed dll can't be saved. HOT 2
- Single File Executable Error: .NET data directory RVA is 0
- Potential feature: Support for 64 bit offsets and length in dnlib.IO HOT 2
- The precise method for calculating 'RVA'
- Can ITypeOrMethodDef implement IMemberDef? HOT 1
- InvalidOperationException when md rva isn't alignment HOT 5
- dnlib is missing NuGet package README file
- ModuleWriterException: Invalid section RVA HOT 1
- Should we update ReturnParameter when updating ReturnType? HOT 2
- .NET cannot install (UAC prompt when running installer)
- dnlib.DotNet.Writer.ModuleWriterException HOT 2
- "Expected a null constant." error when saving assembly with pdb HOT 6
- Why don't CreateGenericInstMethodSig HOT 25
- I already know how UnknownDeclaringType happen HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dnlib.