sn.exe cheat sheet

I don’t find sn.exe command line arguments particularly intuitive, and the fact they’re case sensitive doesn’t exactly put you in the pit of success either.

Also, it turns out there are two kinds of .snk files. One kind is 596 bytes by default and contains a key pair (private and public key). The other kind is 160 bytes typically and only contains the public key.

I’ve looked at sn.exe /? for long enough to compose this cheat sheet. Hopefully it'll be useful to others too.

Create a key pair sn –k private.snk
Extract public key sn –p private.snk public.snk
View public key and public key token sn –tp public.snk
View public key and public key token of assembly sn –Tp assembly.dll
Extract public key from assembly sn –e assembly.dll public.snk
Verify if assembly is signed and with what key sn –vf assembly.dll
Show list of assemblies on machine registered for verification skipping sn –Vl
Register assemblies for verification skipping sn –Vr * (must elevate)
Resign an assembly with the key pair sn –Ra assembly.dll private.snk