All Products
Search
Document Center

Key Management Service:Verify

Last Updated:Nov 11, 2024

This topic explains the process of using the verify command to authenticate a signature.

Feature description

The verify command is used to ascertain if a file is a signature file created using a particular key. This process involves the sign operation. It then compares the signature file to the original file and determines if there is an encryption relationship between them, based on the provided public key and the signature algorithm.

Important

Prior to executing this command, ensure that you have initiated the key_mgmt_tool and signed in to HSM as a CU.

Syntax

Enter the parameters using the syntax provided. For descriptions of each parameter, refer to Parameters.

verify -f <message-file>
       -s <signature-file>
       -k <public-key-handle>
       -m <signature-mechanism>
Important

Parameters must be entered in the sequence specified by the syntax.

Example

The following example demonstrates the verification of an encryption relationship between signedFile and messageFile. The outcome confirms that signedFile is a signature file produced from messageFile using the private key 8 with the SHA256_RSA_PKC signature algorithm. The public key 7 used by verify and the private key 8 used by sign are derived from the same asymmetric key pair.

Command:  sign -f messageFile -k 8 -out signedFile -m 1

       	Signature creation successful

       	signature is written to file signedFile

       	Cfm3Sign: sign returned: 0x00 : HSM Return: SUCCESS

Command:   verify -f messageFile -s signedFile -k 7 -m 1

       	Signature verification successful

       	Cfm3Verify returned: 0x00 : HSM Return: SUCCESS
Important

Parameters must be entered in the sequence specified by the syntax.

Parameters

Parameter Name

Description

Required

Valid Values

-f

Specifies the name of the source file

Yes

No Special Requirements

-k

Specifies the handle of the public key used for verification

Note

The public key for verification must correspond to the private key used for signing.

Yes

No Special Requirements

-m

Specifies the integer representing the signature algorithm

Yes

  • 0: SHA1 with RSA-PKCS

  • 1: SHA-256 with RSA PKCS#1

  • 2: SHA-384 with RSA PKCS

  • 3: SHA-512 with RSA PKCS

  • 4: SHA-224 with RSA PKCS

  • 5: SHA1 with RSA-PKCS#1 PSS

  • 6: SHA-256 with RSA and PKCS#1 PSS

  • 7: SHA-384 with RSA-PKCS#1 PSS

  • 8: SHA-512 with RSA-PKCS#1 PSS

  • 9: SHA-224 with RSA and PKCS#1 PSS

  • 15: ECDSA with SHA1

  • 16: ECDSA with SHA-224

  • 17: ECDSA with SHA256

  • 18: ECDSA with SHA-384

  • 19: ECDSA_SHA512