Skip to main content

署名を管理する

このセクションでは、SMCTL で署名を管理するために使用するコマンドについてカバーします。これらのコマンドは、署名、署名の検証、および署名の削除です。フラグを使用してコマンドのパラメータを指定します。

前提条件

  • すべての署名に使用するツールについて、OSのパス変数に実行形式が存在する必要があります。

  • jarsigner、apksigner、jSign では、PKCS11 の設定ファイルは必須です。

  • 署名に使用する鍵ペアのエイリアスか証明書のフィンガープリントを指定してください。

構成

署名に使用されるデフォルトのツールは、オペレーティングシステムに基づきます。例えば:

  • WindowsではSigntoolが使用されます。

  • Linuxでは、Jsign が Authenticode署名に使用されます。

  • 署名のアルゴリズムは、<--sigalg string> フラグで設定できます(署名に使われるツールが提供するオプションに基づき適用されます)。

  • ダイジェストのアルゴリズムは、<--digalg string> フラグで設定できます(署名に使われるツールが提供するオプションに基づき適用されます)。

  • 特定の種類のファイルに署名する必要がある場合は、<--ツールストリング> フラグを使用します (例: --ツール apksigner は *.apk ファイルにのみ署名します)。

  • 特定の種類のファイルに署名が必要な場合は <--ツールストリング>フラグを使用します (例:--ツール apksigner は *.apk ファイルにのみ署名します)。

  • APK Signerでサポート対象 SDKの最低バージョンは18です。

コマンド

署名を管理するのに利用可能なすべての操作を一覧表示するには、次のコマンドを挿入します。

smctl signature --help

or

smctl signature -h

or

smctl sign --help

or

smctl sign -h

署名

署名コマンドは、以下のように始まります。

smctl signature <keypair alias>

or

smctl sign <keypair alias >

フラグ

署名コマンドは、これらのフラグをサポートしています。

1. 署名のコマンドは、以下のように始まります。

ショートカット

フラグ

説明

--all-metadata

すべての署名のメタデータをキャプチャします。デフォルトでは、すべてのメタデータをキャプチャします。

--certificate string

署名に使用する証明書のパス。

形式:

--certificate="<value>"

--checksum-after-signing

署名のメタデータをキャプチャ - 署名後のチェックサム。デフォルトでキャプチャするには空白のままにします。

--checksum-before-signing

署名のメタデータをキャプチャ - 署名されていないファイルの署名前のチェックサム。デフォルトでは、キャプチャは空白のままです。

--config-file string

PKCS11設定ファイルのパス。

形式:

--config-file="<value>"

--digicert-ctk-app-path string

Provide the path to DigiCert SSM Signing Clients.app.

注記

This flag only applies to Apple codesign and productsign commands.

--digicert-ctk-cli-path string

Provide the path to DigiCert SSM Signing Clients.app's CLI.

注記

This flag only applies to Apple codesign and productsign commands.

-d

--digalg string

使用するダイジェストアルゴリズム(デフォルトは、署名に使用したツールに基づく)。

形式:

--digalg="<value>"

--digest-algorithm

署名のメタデータ - ダイジェストアルゴリズムのメタデータをキャプチャします。デフォルトでキャプチャするには空白のままにします。

--entitlements-file-path

Specify the entitlements file path.

注記

This flag only applies to Apple codesign commands.

--file-location

署名キャプチャのメタデータ - ファイルの場所。デフォルトでキャプチャするには空白のままにします。

--file-name

署名キャプチャのメタデータ - ファイル名。デフォルトでキャプチャするには空白のままにします。

-f

--fingerprint string

署名に使用する証明書のフィンガープリント。

形式:

--fingerprint="<value>"

注記

For Apple codesign and productsign, after the key is added to the token.

--force

Replace existing signatures (default value 'true').

注記

This flag only applies to Apple codesign commands.

--deep

Sign all internal frameworks and plugins (default value 'true').

注記

This flag only applies to Apple codesign commands.

--dryrun

Verify if the file can be signed without actually signing it (default value 'false').

注記

This flag only applies to Apple codesign commands.

--identity string

Specify the apple developer or installer certificate that you will use to sign with. This information can be found using security export-smartcard.

注記

This flag only applies to Apple codesign commands, after the key is added to the token.

-i

--input string

入力ファイルまたはフォルダのパス。フォルダを指定した場合は、そのフォルダ内のすべてのファイルに署名されます。

形式:

--input="<value>"

-k

--keypair-alias string

署名に使用する鍵ペアのエイリアス。

形式:

--keypair-alias="<value>"

--output-file

Signed package file (should be different than input file)

注記

This flag is compulsory for Apple productsign.

--openssl-pkcs11-engine string

Provide the path to the OpenSSL PKCS11 engine.

注記

This flag only applies to osslsigncode.

--pkcs11-module string

Provide the absolute path to the DigiCert​​®​​ Software Trust Manager PKCS11 library.

--preserve-metadata

Preserve the metadata.

注記

This flag only applies to Apple codesign commands.

-s

--sigalg string

使用する署名アルゴリズム(デフォルトは、署名に使用したツールに基づく)。

形式:

--sigalg="<value>"

--signing-tool

署名キャプチャのメタデータ - 署名ツール。デフォルトでキャプチャするには空白のままにします。

--timestamp

タイムスタンプの有効・無効を設定します。デフォルトは有効です。

--timestamp-flag

署名のメタデータを取得する。(タイムスタンプが実行されたかどうか)デフォルトでキャプチャするには空白のままにします。

-t

--tool string

署名に使用するツール(空白のままだと拡張子で署名されます)。

形式:

--tool="<value>"

--tsa-url

署名のメタデータをキャプチャ - TSA URL (タイムスタンプURLを使用します)。デフォルトでキャプチャするには空白のままにします。

-v

--verbose

署名の冗長ロギング。

-h

--help

署名に関するヘルプ。


説明: 指定されたファイルまたはフォルダに、指定された鍵ペアと証明書で署名します。

コマンド:

smctl sign --keypair-alias=<keypair alias> --config-file <path to config file> --input <path to file or folder to be signed>

コマンドの例:

smctl sign --keypair-alias=keypair-dynamic-kp1 --config-file C:\Users\Name\Desktop\smctl\pkcs11properties.cfg --input C:\Users\Name\Desktop\folder_or_files_to_sign

説明: 指定されたファイルまたはフォルダに、提供された証明書のフィンガープリントを使用して署名します。このコマンドは、Windowsでのみ動作します。

コマンド:

smctl sign --keypair-alias=<keypair alias> --input <path to file or folder to be signed>

コマンドの例:

smctl sign --keypair-alias=keypair-dynamic-kp1 -i C:\Users\Name\Desktop\folder_or_files_to_sign

注記

It is no longer necessary to add the <--certificate string> flag to the command because the certificate is automatically downloaded when you specify the keypair alias.

Apple examples

Description: Codesign a .app file using the keypair alias of the Apple certificate.

Command:

smctl-mac-x64 sign --keypair-alias <keypair_alias of apple certificate> --input <path_of_app or dmg_file_to_be_signed>

Command sample:

smctl-mac-x64 sign -k apple_codesign --verbose=true --input /Users/Name/Downloads/Example.app

Description: Verify if the file can be signed using codesign.

Command:

smctl-mac-x64 sign --keypair-alias <keypair_alias of apple certificate keypair> --dryrun=true --input <path_of_app/dmg_file_to_be_signed>

Command sample:

smctl-mac-x64 sign -k apple_codesign --verbose=true –dryrun=true --input /Users/Name/Downloads//Example.app 

Description: Verify if .app file was signed.

Command:

smctl-mac-x64 sign verify --input <path_of_signed_app/dmg_file>

Command sample

smctl-mac-x64 sign verify --input /Users/Name/Downloads//Example.app

Description: Sign .pkg file using productsign.

Command:

smctl-mac-x64 sign  --keypair-alias < keypair_alias of apple certificate > --verbose  --input <path_of_pkg_file_to_be_signed>

Command sample:

smctl-mac-x64 sign -k apple_installer_productsign --verbose=true --input /Users/Name/Downloads/test.pkg 

Description: Verify if .pkg file was signed.

Command:

smctl-mac-x64 sign verify --verbose --input <path_of_signed_pkg_file>

Command sample

smctl-mac-x64 sign verify --verbose=true --input /Users/Name/Downloads/test.pkg

サブコマンド

署名コマンドは、これらサブコマンドをサポートしています。

smctl signature <subcommand>

or

smctl sign <subcommand>

2. 署名の管理のサブコマンド

サブコマンド

説明

remove

署名を削除する

verify

署名を検証する

sign-hash

Sign hashes.

verify-hash

Verify hashes.

in-toto

Sign and verify JSON SBOMs using in-toto functionality.


署名を削除する

以下で始まる署名コマンドを削除します。

smctl sign remove

フラグ

署名を削除するコマンドは、以下のフラグをサポートしています。

3. 署名を削除するフラグ

ショートカット

フラグ

説明

-i

--input string

ファイルまたはフォルダを指定します。フォルダを指定すると、そのフォルダ内のすべてのファイルの署名が削除されます(signtool のみサポート)。

形式:

--input="<value>"

-h

--help

削除に関するヘルプ。


説明: 指定されたファイルまたは指定されたフォルダ内のファイルの電子署名を削除します。

コマンド:

smctl sign remove --input <path to file or folder to be signed>

コマンドの例:

smctl sign remove -i C:\Users\Name\Desktop\file_or_folder_with_files_to_be_signed

署名を検証する

署名検証のコマンドは、以下のように始まります。

smctl signature verify

or

smctl sign verify

フラグ

署名の検証コマンドは、以下のフラグをサポートしています。

4. 署名を検証するフラグ

ショートカット

フラグ

説明

-f

--fingerprint string

検証に使用する証明書のフィンガープリント。これは、使用するツールのオプションに基づき適用されます。

形式:

--fingerprint="<value>"

-i

--input string

ファイルまたはフォルダを指定します。フォルダを指定した場合は、そのフォルダ内のすべてのファイルが検証の対象となります。

形式:

--input="<value>"

-t

--tool

Specify the signing tool to be used for signing files. Omit this parameter to allow SMCTL to select an appropriate signing tool based on the file extension.

-q

--quiet

Specify this parameter to limit the output of the command to a simple one confirmation of success or failure.

-v

--verbose

Specify this parameter to enable detailed output of the command, providing comprehensive information about the signing process, including success and failure details.

-h

--help

検証に関するヘルプ。


説明: 指定されたファイルパスにある証明書のフィンガープリントで参照される署名を検証します。

コマンド:

smctl sign verify --fingerprint <certificate fingerprint> --input <path to file or folder to be verified>

コマンドの例:

smctl sign verify --fingerprint da39a3ee5e6b4b0d3255bfef95601890afd80709 -i C:\Users\Name\Desktop\file_or_folder_with_files_to_be_verified

署名を管理する

このセクションでは、SMCTL で署名を管理するために使用するコマンドについてカバーします。これらのコマンドは、署名、署名の検証、および署名の削除です。フラグを使用してコマンドのパラメータを指定します。

前提条件

Sign-hash commands begin with:

smctl sign sign-hash <keypair ID>

Subcommands

The sign-hash command supports these subcommands:

5. Flag for managing hashing signing

Shortcut

Flag

Description

--binary

Signature in binary (default is Base64).

--file string

File path.

--hash string

Base64 hash.

--hash-algorithm string

Hash algorithm. (default "SHA-256")

--signature-algorithm string

Signature algorithm. (default "SHA256withRSA").

--signature-file string

Signature file path.

-h

--help

Help for sign-hash commands.


署名を削除する

説明: 指定されたファイルまたは指定されたフォルダ内のファイルの電子署名を削除します。

コマンド:

smct sign sign-hash --file <file path> --hash-algorithm <hash algorithm> --signature-algorithm <algorithm> <keypair ID> --signature-file <signature file path> --binary

コマンドの例:

smct sign sign-hash --file UNSIGNED_JAR.jar --hash-algorithm SHA-512 --signature-algorithm MLDSA44 c16f3975-101b-4837-8de5-42160e791220 --signature-file mldsasign44.txt --binary

署名を管理する

このセクションでは、SMCTL で署名を管理するために使用するコマンドについてカバーします。これらのコマンドは、署名、署名の検証、および署名の削除です。フラグを使用してコマンドのパラメータを指定します。

前提条件

Verify-hash commands begin with:

smctl sign verify-hash <keypair ID>

Subcommands

The verify-hash command supports these subcommands:

6. Flag for managing hash verification

Shortcut

Flag

Description

--file string

File path.

--hash string

Base64 hash.

--hash-algorithm string

Hash algorithm. (default "SHA-256")

--signature string

Base64 Signature.

--signature-algorithm string

Signature algorithm. (default "SHA256withRSA").

--signature-file string

Signature file path.

-h

--help

Help for sign-hash commands.


署名を削除する

説明: 指定されたファイルまたは指定されたフォルダ内のファイルの電子署名を削除します。

コマンド:

smctl sign verify-hash --file <file path> --hash-algorithm <hash algorithm> --signature-algorithm <signature algorithm> --signature-file <path to signature file> <keypair ID>

コマンドの例:

smctl sign verify-hash --file UNSIGNED_JAR.jar --hash-algorithm SHA-512 --signature-algorithm MLDSA44 --signature-file mldsasign44.txt c16f3975-101b-4837-8de5-42160e791220

署名を管理する

このセクションでは、SMCTL で署名を管理するために使用するコマンドについてカバーします。これらのコマンドは、署名、署名の検証、および署名の削除です。フラグを使用してコマンドのパラメータを指定します。

注記

SHA3 digest signing and verification is not currently supported for RSA keys.

前提条件

Sign commands begin with:

smctl sign in-toto <subcommand>

Subcommands

The sign command supports these subcommands:

7. Subcommands for managing signatures

Shortcut

Subcommand

Description

cyclonedx

Sign CycloneDX JSON SBOMs using In-toto functionality.

spdx

Sign SPDX JSON SBOMs using In-toto functionality.

verify

Verify JSON SBOMs using In-toto functionality

-h

--help

Help for in-toto commands.


署名を削除する

以下で始まる署名コマンドを削除します。

smctl sign in-toto cyclonedx <sbom file path> <keypair ID or alias>

フラグ

署名を削除するコマンドは、以下のフラグをサポートしています。

8. 署名を削除するフラグ

ショートカット

フラグ

説明

 

--artifact-digest string

ファイルまたはフォルダを指定します。フォルダを指定すると、そのフォルダ内のすべてのファイルの署名が削除されます(signtool のみサポート)。

--hash-algorithm string

Hash algorithm for the signature (default "SHA256").

注記

SHA3 digest signing is not currently supported for RSA keys.

--signed-file string

File name of the signed SBOM (default "signed_"+InputFileName)

-h

--help

削除に関するヘルプ。


説明: 指定されたファイルまたは指定されたフォルダ内のファイルの電子署名を削除します。

コマンド:

smctl sign in-toto cyclonedx <sbom file path> <keypair ID or alias>

コマンドの例:

smctl sign in-toto cyclonedx  C:\Workspace\sbom-signing\golang.cyclonedx.json fcfecdeb-4412-4796-962a-1c135948a15f

Sign SPDX JSON SBOMs

Sign SPDX JSON SBOMs commands begins with:

smctl sign in-toto cyclonedx <sbom file path> <keypair ID or alias>

Flags

The SPDX signature command supports these flags:

9. Flags for signing SPDX JSON SBOMs

Shortcut

Flag

Description

--artifact-digest string

SHA256 digest of the artifact for which this SBOM was generated.

--hash-algorithm string

Hash algorithm for the signature (default "SHA256").

注記

SHA3 digest signing is not currently supported for RSA keys.

--signed-file string

File name of the signed SBOM (default "signed_"+InputFileName)

-h

--help

Help for signing SPDX JSON SBOMs.


Example

Description: Sign SPDX JSON SBOM.

Command:

smctl sign in-toto spdx <sbom file path> <keypair ID or alias>

Command sample:

smctl sign in-toto spdx C:\Workspace\sbom-signing\golang.spdx.json 30dbb169-b120-4df6-b8fc-16e995909107

Verify JSON SBOMs command

注記

SHA3 digest verification is not currently supported for RSA keys.

Verify JSON SBOMs commands begins with:

smctl sign in-toto verify

Subcommands

The verify JSON SBOM signature command supports these subcommands:

10. Subcommands for verify JSON SBOMs signatures

Shortcut

Flag

Description

keypair-id

Verify a signed JSON SBOM using the hash algorithm and keypair ID.

public-key

Verify a signed JSON SBOM using the hash algorithm and public key present in a PEM or DER file.

-h

--help

Help for verifying JSON SBOMs.


Example

Description: Verify a signed JSON SBOM using the hash algorithm and keypair ID.

Command:

smctl sign in-toto verify keypair-id <signed file> <hash algorithm> <keypair ID or alias>

Command sample:

smctl sign in-toto verify keypair-id C:\Workspace\sbom-signing\signed_golang.cyclonedx.json SHA256 fcfecdeb-4412-4796-962a-1c135948a15f

Example

Description: Verify a signed JSON SBOM using the hash algorithm and public key present in a PEM or DER file.

Command:

smctl sign in-toto verify public-key <path to public key> <hash algorithm> <keypair ID or alias>

Command sample:

smctl sign in-toto verify public-key C:\Workspace\sbom-signing\signed_golang.cyclonedx.json SHA256 new-keypair.pem