Reputation: 181
Is it possible to create a .snk file programatically and using that file I want to get the public key token?
Upvotes: 2
Views: 1772
Reputation: 6116
Something like this ought to do what you want:
CspParameters parms = new CspParameters();
parms.KeyNumber = 2;
RSACryptoServiceProvider provider = new RSACryptoServiceProvider(parms);
byte[] array = provider.ExportCspBlob(!provider.PublicOnly);
StrongNameKeyPair snk = new StrongNameKeyPair(array);
byte[] publicKey = snk.PublicKey;
Upvotes: 2