POST Codesign/CreateTemplate

Creates a new, empty CodeSign Protect Environment template based on a TemplateType. Use other API calls to add suggested or required values to use in the parent Environment. After you finish the template, a Owner can create an environment from the template.

One or more environments can be used as part of a signing project. If the project environment requires multiple signing keys, be sure to use the PerUser setting. Then, call POST Codesign/UpdateTemplate to apply macro settings for object creation.

Requirements

  • Permissions: The caller must be a Code Signing Administrator.
  • Token scope:  Codesign:Manage

Headers

  • Content type: Content-Type:application/json.

  • Token: The bearer access token that you received. For example, Authorization:Bearer 4MyGeneratedBearerTknz==. For more information, see Passing a bearer token in your API calls.

Parameters

Input parameters

Name

Description

Dn

The Distinguished Name (DN) of the environment. Use the appropriate syntax. For example, in Postman: \\VED\\Code Signing\\Projects\\PrjName\\[YourEnvName].

PerUser

(Optional) Immutable. The mode that supports multiple cryptographic objects to use for signing. Applies only to Code Signing Certificate Environment Template and Code Signing GPG Environment Template.

  • true: Store signing Certificate objects in the Policy Tree by a user's identity.

  • false: Default. Projects that use this template allow the key pairs that are required by the environment. Multiple signers use the same cryptographic objects. One Certificate object for this template. No macro filtering.

TemplateType

(Optional) One of the following encryption methods for signing code:

  • Code Signing Apple Environment Template
  • Code Signing Certificate Environment Template
  • Code Signing CSP Environment Template
  • Code Signing DotNet Environment Template
  • Code Signing Key Pair Environment Template
  • Code Signing GPG Environment Template

Returns

For valid requests, CreateTemplate returns a HTTP 200 message and the following data in the message body:

Response description

Name

Description

HTTP 200

 

For valid requests, this call returns a HTTP 200 message and the following data in the message body:

HTTP 400

For invalid requests, this call returns HTTP 400 Bad Request and the following data in the message body:

  • error: The reason for the error.
  • error_description: If available, additional information about how to retry the request.

Example: Create a project template

Request

POST https://codesign.venafi.example/vedsdk/Codesign/CreateTemplate
Authorization:Bearer 4MyGeneratedBearerTknz==
{
    "Dn": "\\VED\\Code Signing\\Environment Templates\\MyTemplate",
    "TemplateType": "Code Signing Certificate Environment Template",
    "PerUser": true
}

Response

HTTP/1.1 200 
{
   "CertificateTemplate":{
      "Dn":"\\VED\\Code Signing\\Environment Templates\\MyTemplate",
      "Guid":"{b7eea547-ee4a-490a-a829-c511dff7d292}",
      "Id":736,
      "PerUser":true,
      "Type":"Code Signing Certificate Environment Template",
      "VisibleTo":{
         "Items":[
            
         ]
      },
      "CertificateAuthorityDN":{
         "Info":1,
         "Value":{
            "Items":[
               
            ]
         }
      },
      "CertificateSubject":{
         "Info":1,
         "Value":{
            "Items":[
               
            ]
         }
      },
      "City":{
         "Info":1,
         "Value":{
            "Items":[
               
            ]
         }
      },
      "Country":{
         "Info":1,
         "Value":{
            "Items":[
               
            ]
         }
      },
      "KeyAlgorithm":{
         "Info":1,
         "Value":{
            "Items":[
               
            ]
         }
      },
      "KeyStorageLocation":{
         "Info":1,
         "Value":{
            "Items":[
               
            ]
         }
      },
      "Organization":{
         "Info":1,
         "Value":{
            "Items":[
               
            ]
         }
      },
      "OrganizationalUnit":{
         "Info":1,
         "Value":{
            "Items":[
               
            ]
         }
      },
      "SANEmail":{
         "Info":1,
         "Value":{
            "Items":[
               
            ]
         }
      },
      "State":{
         "Info":1,
         "Value":{
            "Items":[
               
            ]
         }
      }
   },
   "Result":1,
   "Success":true
}