Veracode API credentials file
Some Veracode products, such as the IDE plugins and extensions, require you to store your API credentials in a secure file called a Veracode API credentials file.
The Veracode API credentials file only supports HMAC credentials. OAuth Client credentials aren't supported.
You create the Veracode API credentials file on a Windows, macOS, Linux, or UNIX machine, and place the file in a specific directory on one or more machines where you use APIs or integrations. The integration, API wrapper, or command-line tool reads the file from this directory to access your credentials and authenticate securely with Veracode.
Alternatively, you can set your credentials as environment variables. Use either the Veracode API credentials file or environment variables, but not both.
Create an API credentials file on Windows
Create the file on Windows to store your API credentials and, optionally, encrypt it for added security.
Before you begin:
- Ensure you have created HMAC credentials.
- Ensure you have added your API credentials to the
[default]application profile. If you have a[greenlight]profile, delete it or rename it to[default].
To complete this task:
-
In File Explorer, go to
C:\Users\{username}, whereusernameis your Windows user profile folder. -
Create a new folder named
.veracode..ImportantThe folder name must begin and end with a period (.). The second period ensures that the folder name begins with a period, but only the first period appears in the folder name.
-
Open a text editor, such as Notepad, and add your API credentials to a new file in the following format:
[default]
veracode_api_key_id = <your HMAC ID>
veracode_api_key_secret = <your HMAC Secret Key>The spaces around the equals signs (=) are optional.
-
Select File > Save As.
-
For File name, enter
"credentials".noteInclude the quotation marks to prevent Notepad from adding a file extension.
-
Select Save. If the file has an extension, such as TXT, open the file properties and remove the extension.
-
Optionally, to restrict access to the file, in the file properties, select Encrypt contents to secure data in the Advanced Attributes window.
Create an API credentials file on macOS, Linux, or UNIX
Create the file on macOS, Linux, or UNIX to store your API credentials and, optionally, restrict access to the file.
Before you begin:
- Ensure you have created HMAC credentials.
- Ensure you have added your API credentials to the
[default]application profile. If you have a[greenlight]profile, delete it or rename it to[default].
To complete this task:
-
On the command line, navigate to your home folder. For example,
$HOME. -
To create the
.veracodefolder, run:$ mkdir .veracode -
Navigate to the
.veracodefolder. For example:$ cd .veracodenoteOn macOS, the
.veracodefolder is hidden by default because its name starts with a period. -
To create the
credentialsfile, run:$ touch credentials -
Open Finder to
.veracode. -
Open the
credentialsfile in a text editor. -
Copy the following text and paste it into the
credentialsfile:[default]
veracode_api_key_id = <your HMAC ID>
veracode_api_key_secret = <your HMAC Secret Key>The spaces around the equals signs (=) are optional.
-
Replace the values with your credentials.
-
Save the
credentialsfile. -
Optionally, to restrict access to the
credentialsfile, run:chmod 600 ~/.veracode/credentials