Skip to main content

強力な名前の署名

強力な名前は、アセンブリの単純なテキスト名、バージョン番号、およびカルチャ情報 (提供されている場合)、公開鍵、およびデジタル署名で構成されています。これは、対応する秘密鍵を使用してアセンブリファイルから生成されます。(アセンブリファイルには、アセンブリを構成するすべてのファイル名とハッシュを含むアセンブリマニフェストが含まれています。)

Strong name signing tools are built by Microsoft with Legacy CSP (Crypto Service Provider). Therefore, it is mandatory to have DigiCert​​®​​ Software Trust Manager CSP)installed on your system before you can use a signing tool to create a strong name assembly.

前提条件

制限

この強力な名前の CSP には、以下の制限があります。

  • RSA鍵のみをサポートする。

  • SHA-1 ダイジェスト・アルゴリズムのみをサポートする。

  • 強力な名前署名に必要なのは鍵だけです(証明書は必要ありません)。

Register the CSP

ヒント

If you have downloaded and installed the Windows Clients Installer, the CSP is already downloaded and registered as part of the installation.

If you have downloaded the CSP as an individual file, register the CSP by following the steps below:

  1. Copy the downloaded CSP to the C:\windows\System32 directory named ssmcsp.dll: c:\windows\System32\ssmcsp.dll

  2. To register the CSP, open a command prompt in Administrator mode and run:

    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Defaults\Provider\DigiCert Software Trust Manager CSP"
    
    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Defaults\Provider\DigiCert Software Trust Manager CSP" /v "SigInFile" /t REG_DWORD /d 0
    
    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Defaults\Provider\DigiCert Software Trust Manager CSP" /v "Type" /t REG_DWORD /d 1
    
    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Defaults\Provider\DigiCert Software Trust Manager CSP" /v "Image Path" /t REG_SZ /d "ssmcsp.dll
  3. To check if your CSP is successfully registered and ready to use, run:

    C:\windows\system32\certutil.exe -csplist

    注記

    You should see an entry named DigiCert Software Trust Manager CSP in the output.

署名ツール

構成

DigiCert​​®​​ Software Trust Manager で保護された鍵ペアを使用して、以下の署名ツールを使用して強力なネームアセンブリを作成するには、ユーザーはまず sn.exe ツールで DigiCert CSP(DigiCert​​®​​ Software Trust Manager CSP)を設定しなければなりません。

  1. Administrator モードでコマンドラインを開く。

  2. sn.exe -c "DigiCert​​®​​ Software Trust Manager CSP" を実行します。

Signing

アセンブリに強力な名前を付けるには、さまざまな方法とツールがあります。以下の表は、これまでにテストされたツールと、必要なアーティファクトの種類を説明したものです。

1. ツール

ツール

アーティファクトのタイプ

ツールのあり得るパス

コメント

sn.exe

署名したアセンブリをテストする (.dll files)

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\sn.exe

Windows SDKとNET framework toolsのバージョン番号は、お使いのマシンにより異なる場合があります。

csc.exe

C#ソースコード (.csファイル)

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe

.NET frameworkのインストール先やバージョンは、お使いのマシンによって異なる場合があります。

Ilasm.exe

中間コード (.ilファイル)

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ilasm.exe

.NET frameworkのインストール先やバージョンは、お使いのマシンによって異なる場合があります。


署名コマンドの例

  • sn.exe

  • csc.exe "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe" /target:library /keycontainer:hello_world /out:helloworld.dll *.cs.

  • ilasm.exe "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ilasm.exe" /dll /key=@hello_world /quite helloworld.il

強力な名前の検証

署名と同じマシンで検証を行い、sn.exe -v "assembly path" で検証を行う場合、CSPをデフォルトにリセットしていることを確認します。

  1. コマンドプロンプトを管理者権限で開きます。

  2. sn.exe -c を実行します。

  3. 検証のための実行(管理者権限なし) sn -v

注記

強力な名前アセンブリを含むソフトウェアをインストールする際に強力な名前検証で失敗しないように、署名後のCSpをデフォルトに設定します。

トラブルシューティング

  • それぞれのDigiCert ONE環境に接続するのに、必要かつ必須のSM_*環境変数がすべて設定されていることを確認します。

  • CSP dllファイルが「C:weņwindowsSystem32」と「C:weņwindowsSysWOW64」に存在することを確認します。

  • .signingmanager\logs\ssmcsp.ログファイルをチェックして、エラーや警告が記録されていることを確認します。

  • Sn.exeコマンドラインを使用して、「DigiCert​​®​​ Software Trust Manager CSP」が設定されていることを確認します。詳細については、上記の署名ツール > 設定セクションを参照してください。

参照

強力な名前のアセンブリを作成・使用する