次の方法で共有


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

Comments

  • Anonymous
    May 07, 2014
    The comment has been removed
  • Anonymous
    December 13, 2016
    Note that sn -tp private.snk won't work on a private key (596 bytes) so you need to first run sn -tp private.snk public.snk, then run sn -tp public.snk.