Skip to Main Content
C# in a Nutshell
book

C# in a Nutshell

by Ben Albahari, Ted Neward, Peter Drayton
March 2002
Intermediate to advanced content levelIntermediate to advanced
864 pages
31h 8m
English
O'Reilly Media, Inc.
Content preview from C# in a Nutshell

Name

Sn.exe — Strong Name Utility

Synopsis

sn options

Description

Verifies assemblies and their key information. Also generates key files and manages Cryptographic Service Provider (CSP) containers, which provide a layer of abstraction over key storage and management. CSPs are enumerated in the HKLM\SOFTWARE\Microsoft\Cryptography\Defaults\Provider registry key. See GacUtil.exe for an example of signing an assembly.

Examples

Create a new key-pair:

C:\home>sn -k mykey.snk
  
Microsoft (R) .NET Framework Strong Name Utility  Version 1.0.3617.0
Copyright (C) Microsoft Corporation 1998-2001. All rights reserved.
  
Key pair written to mykey.snk

Add that key-pair to a container:

C:\home>sn -i mykey.snk MyContainer
  
Microsoft (R) .NET Framework Strong Name Utility  Version 1.0.3617.0
Copyright (C) Microsoft Corporation 1998-2001. All rights reserved.
  
Key pair installed into 'MyContainer'

Extract the public key from the key in the container:

C:\home>sn -pc MyContainer pubkey.out
  
Microsoft (R) .NET Framework Strong Name Utility  Version 1.0.3617.0
Copyright (C) Microsoft Corporation 1998-2001. All rights reserved.
  
Public key written to pubkey.out

Options

-?, help

Displays usage information and exits.

-c [ csp ]

Sets the default CSP for your machine. With no arguments, resets the CSP to the default.

-d container

Deletes the specified key container.

-D assembly1 assembly2

Compares two assemblies and verify that they differ only by signature.

-e assembly file

Extracts an assembly’s public key into file.

-i file ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# 8.0 in a Nutshell

C# 8.0 in a Nutshell

Joseph Albahari, Eric Johannsen
C# 10 in a Nutshell

C# 10 in a Nutshell

Joseph Albahari
C# in a Nutshell, Second Edition

C# in a Nutshell, Second Edition

Peter Drayton, Ben Albahari, Ted Neward
Code like a Pro in C#

Code like a Pro in C#

Jort Rodenburg

Publisher Resources

ISBN: 0596001819Catalog PageErrata