POST Codesign/CreateEnvironment

Adds a new signing environment to a project. The environment manages the way applications will be code signed. The environment only becomes active after a Code Signing Administrator approves the project.

Requirements

  • Permissions:  The caller must be a Code Signing Administrator, or a member of any role on the project that owns the environment.
  • 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

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

EnvironmentName

Specify DN or EnvironmentName. The name of the new environment you want to create.

Project

The project that will use this environment. To get these values, look in the UI or call POST Codesign/EnumerateProjects.

  • Dn: The Distinguished Name (DN) of the project, which identifies its location and name. For example, \\VED\\Code Signing\\Projects\\APIProjectDraft.

  • Guid: The project unique identifier. For example, {7ec6692c-c095-4afa-9515-e4dc3c01fd55}

    Where is the Project Guid

  • Id: The project ID.

[Template]

The template that has default values. Specify a template name that will provide an environment for users. For example if the environment will manage Microsoft .NET signings, use the Dot Net template. To get the values, call POST Codesign/GetTemplate:

TemplateDn

(Optional) The location of the Template that this environment will use. If the template is missing or invalid, this API call uses the default template.

Returns

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.

HTTP 500

For invalid requests, this call returns a HTTP 500 Unexpected Exception:

Error: The reason for the error.

Example: Create a signing environment for a project

Request

POST https://codesign.venafi.example/vedsdk/Codesign/CreateEnvironment
Authorization:Bearer 4MyGeneratedBearerTknz
{
   "EnvironmentName":"GPGEnv",
   "TemplateDN":"\\VED\\Code Signing\\Environment Templates\\GPG",
   "Guid":"{2a65619c-ac68-4ec0-850b-1b29b09941ed}",
   "Project":{
      "Dn":"\\VED\\Code Signing\\Projects\\Sample",
      "Guid":"{a26de394-3403-49e3-9164-6ebe8bf23560}",
      "Id":152516
   },
   "GPGTemplate":{ ...
      
   }
}

Response

HTTP/1.1 200 OK
{
   "GPGEnvironment":{
      "AllowUserKeyImport":true,
      "CustomFieldAttributes":{
         "Items":[
            
         ]
      },
      "Disabled":true,
      "Dn":"\\VED\\Code Signing\\Projects\\RESTProjectwithSignProject\\MyGpGEnvREST2",
      "Guid":"{d477fd95-d9b4-41e2-9553-5bfac336b418}",
      "IPAddressRestriction":{
         "Items":[
            
         ]
      },
      "Id":653,
      "KeyTimeConstraints":{
         "Items":[
            
         ]
      },
      "KeyUseFlowDN":"\\VED\\Code Signing\\Flows\\No Restrictions",
      "TemplateDN":"\\VED\\Code Signing\\Environment Templates\\GPG",
      "Type":"Code Signing GPG Environment",
      "AuthenticationKeyAlgorithm":{
         "Info":1,
         "TemplateValues":null,
         "Value":null
      },
      "AuthenticationKeyDN":"\\VED\\Policy\\Code Signing\\Certificates\\RESTProjectwithSignProject MyGpGEnvREST2 - Authentication Key",
      "Email":{
         "Info":1,
         "TemplateValues":null,
         "Value":null
      },
      "EncryptionKeyAlgorithm":{
         "Info":1,
         "TemplateValues":null,
         "Value":null
      },
      "EncryptionKeyDN":"\\VED\\Policy\\Code Signing\\Certificates\\RESTProjectwithSignProject MyGpGEnvREST2 - Encryption Key",
      "Expiration":{
         "Info":1,
         "TemplateValues":null,
         "Value":null
      },
      "GPGTemplate":{ ...

   },
   "Result":1,
   "Success":true
}