Generate Digital Signature for Hash

This API allows users to compute the digital signature for a given hash using a specified signing policy and key details.

Before you begin

  • Configure the signing policy with relevant details, ensuring mapping to the enrolled certificate (also identified as the signing key on the signing policy page).

Request Structure

Endpoint: /code-signing-generate-hash
Type: POST
Sample URL: https://<IP/HostName/TenantName>:<GWPORT>/avxapi/code-signing-generate-hash?gwsource=external

To understand the elements of the sample URL, click here.

Headers:
Content-Type: application/json
Table 1. Input Parameter
Name Description
sessionId

Header

(Mandatory) After successfully logging in, a unique identifier assigned to a user's session after successful authentication. The session ID remains valid until it expires. The session ID is a string value.

Example: "ce7f1a14-2bf9-4e4a-89a8-bc780a255813"

username

Header

(Mandatory) AppViewX login username, represented as a string value.

Example: "User"

password

Header

(Mandatory) AppViewX login username, represented as a string value.

Example: "AppViewX@123"

Payload (Mandatory) Input data for request body in application/json format. For payload details, see Payload section.

Payload

Name Description
signingPolicy

String

(Mandatory) Enter the signing policy for code signing which is a string value.

Example: "Test_Policy_01"

signingKey

String

(Mandatory) Enter the signing key for code signing which is a string value.

Example: "Google CA Code Signing Certificate_Demo=A5:09:C1:6C:3F:72: 81:61:59:3A:58:EA:ED:33:11:ED:64:91:DC"

versionNumber

String

(Mandatory) Enter the version number for code signing, which should be a string value.

Example: "v1"

description

String

(Mandatory) Description of the hash generation, provided as a string value.

Example: "Hash Signing"

signedType

String

(Mandatory) Select the code signed type, a string that specifies Hash Based sign.

Example: "Hash Based Signing"

fileHashContent

String

(Mandatory) Enter the hash file content as a string value.

Example: "MDEwDQYJYIZIAWUDBAIBBQAEIPw9hz6RJNKrng4tnsFCUGKXA6qAyxRe2kFVOjdpfTMw"

signatureType

String

(Optional) This ensures compliance with a designated signature format while also allowing for potential support of additional signing types in the future.

Example: "RAW"

addOnFields

List<Map<String, String>>

(Optional) Specify additional fields needed for code signing.

Example: "addOnFields": [{"Version":"V1"},{"Build":"1"}]

Response Structure

  • Status Code: 200 OK
  • Message: Successful
  • Headers:
    • Content-Type: application/json
Table 2. Response Parameters
Name Description
response Contains the response attributes for generating the signature for the code signing request.
message Success message or failure description in case of error.
appStatusCode Application specific status code for the response. Will be non-null for failure response.
tags More info in case of failure response.

Status Codes

HTTP Code appStatusCode Response Message
200 OK null Successful
403 Forbidden CODE_SIGNING_0032 Permissions are not there to sign the hash of a file
500 Internal Server Error CODE_SIGNING_0062 IP provided is invalid
500 Internal Server Error CODE_SIGNING_0083 The retrieved IP address is not valid. The selected policy does not support the obtained IP address.
500 Internal Server Error CODE_SIGNING_0063 Your chosen signing type is not supported by the selected policy
500 Internal Server Error CODE_SIGNING_0056 Signing Policy Info is not present in the Database for the given input
500 Internal Server Error CODE_SIGNING_0070 Signing Key is not mapped to the given policy.
500 Internal Server Error CODE_SIGNING_0073 Certificate is not present in the cert inventory
500 Internal Server Error CODE_SIGNING_0021 Error in updating the signed data
500 Internal Server Error CODE_SIGNING_0066 Failed to convert to json string
500 Internal Server Error CODE_SIGNING_0067 Failed to encrypt
500 Internal Server Error CODE_SIGNING_0020 Error in generating the signed file
400 Bad Request CODE_SIGNING_00222 Add-on fields are not configured for the given policy.
400 Bad Request CODE_SIGNING_0082 Mandatory fields are missing in the Add-ons Section.
400 Bad Request CODE_SIGNING_00225 Multiple Add-on fields within a single key-value pair is not allowed.
400 Bad Request CODE_SIGNING_00223 Provided Add-on fields are not configured for the given policy.
400 Bad Request CODE_SIGNING_0080 Wrong Input Payload for the text fields in the text block.
400 Bad Request CODE_SIGNING_0081 Invalid Number added in the Add-ons section.
500 Internal Server Error CODE_SIGNING_00220 Your chosen signature type is currently not supported.

Sample Request/Response

Use Case

To generate a hash for code signing using code-signing-generate-hash API.

Request URL
https://<IP/HostName/TenantName>:<GWPORT>/avxapi/code-signing-generate-hash?gwsource=external
Request Payload
{
  "payload": {
    "signingPolicy": "Hash_Policy",
    "signingKey": "AppViewX Private Ltd=56:37:33:0E:B1:7D:E4:69:E7:8E:CF:83:56:59:43:93:DD:18:B4",
    "description": "Hash Signing",
    "signedType": "Hash Based Signing",
    "fileHashContent": "MDEwDQYJYIZIAWUDBAIBBQAEIPw9hz6RJNKrng4tnsFCUGKXA6qAyxRe2kFVOjdpfTMw",
    "signatureType": "RAW",
    "addOnFields": [
      {
        "Version": "V1"
      },
      {
        "Build_No": "1"
      }
    ]
  }
}
Sample Response
{
    "response": "gutIcFnlzbTT7slB1wrOAbMPzhgFszs8nA1DpMLE/7BcAP39vbgIOCIj1rlmM6bSnBl1bJ3U3CMSWqphEu8KzN9gcCknGTyAOJxEiIXOmi0P9ernL4knxoGnDe//89/rC3drt4XqLahHF7mMKrXLCLGqg0UTpOzUM0ZxQTucz4Z2iWipH3R3wNq4gYB4EijPXkp+7D0Q2PGaIiy9/1LhGzwvappbqU9QBFu3Nkr40jepEs7dGcEFYlw4E1spH+gcJsFEAN1H3UToP6zDiBSEq0ZiwXj0mU+pJGxIG49x7jOaDJgAS+p6/ll9eulwRk7Ft4NXoXwWkvYZTx2HAMz0mg==",
    "message": null,
    "appStatusCode": null,
    "tags": null,
    "headers": null
}

Reference

Understanding the sample URL:
  • IP/HostName/TenantName: Replace with the actual IP address, hostname, or tenant name based on the specific configuration in AppViewX.
    • IP: A unique identifier assigned to each device connected to a computer network that uses the Internet Protocol for communication

      The IP address will be included in the endpoint URL for an on-prem deployment.

    • HostName: A human-readable label assigned to a device (host) on a network

      The hostname will be included in the endpoint URL for an on-prem deployment.

    • TenantName: An identifier label for a tenant given to indicate which tenant's data the API request will access/modify

      The tenant name will be included in the endpoint URL for a SaaS deployment.

  • GWPORT: AppViewX gateway port

    A gateway port refers to a network port through which data is sent and received to communicate with a gateway in an on-prem deployment.

    Example: 31443

  • avxapi: Path parameter value (static) that is part of the endpoint's URL
  • Endpoint: Endpoint of the API, for example: execute-hook
  • gwsource: Source or origin of a gateway, for example: external.