POST Enrollment PFX

The POST /EnrollmentClosed Certificate enrollment refers to the process by which a user requests a digital certificate. The user must submit the request to a certificate authority (CA)./PFXClosed A PFX file (personal information exchange format), also known as a PKCS#12 archive, is a single, password-protected certificate archive that contains both the public and matching private key and, optionally, the certificate chain. It is a common format for Windows servers. method is used to enroll for a certificate by supplying data in the desired fields. This method returns HTTP 200 OK on a success with a message body containing a list of certificate details and any metadataClosed Metadata provides information about a piece of data. It is used to summarize basic information about data, which can make working with the data easier. In the context of Keyfactor Command, the certificate metadata feature allows you to create custom metadata fields that allow you to tag certificates with tracking information about certificates. that was associated with the certificate request.

Tip:  The following permissions (see Security Roles and Claims) are required to use this feature:

/certificates/enrollment/pfx/

Global or container-level schedule permissions for certificate stores are needed to install a certificate generated with this method into a certificate store (see the x-Certificate Format parameterClosed A parameter or argument is a value that is passed into a function in an application.) using the POST /Enrollment/PFX/Deploy method (see POST Enrollment PFX Deploy) or POST /Enrollment/PFX/Replace method (see POST Enrollment PFX Replace).

Tip:  Use the GET /Enrollment/PFX/Context/My method before this method to check which templates and CAs are available for enrollment for the requesting user before submitting the enrollment request.

This method has two available versions. Keyfactor recommends using the newer method when possible. For more information about versioning, see Versioning.

Version 2 of the POST /Enrollment/PFX method redesigns how enrollment flow works to handle require approval functionality in a Keyfactor Command workflow with support for delivery into certificate stores. Users who are planning to use require approval workflow functionality and deliver enrolled certificates into certificate stores must use version 2 of this endpointClosed An endpoint is a URL that enables the API to gain access to resources on a server..

Note:  The supported key algorithms for a certificate templateClosed A certificate template defines the policies and rules that a CA uses when a request for a certificate is received. are determined based on global template policy, individual template policy, and the template's supported algorithm.

When configuring template-level policies for key information, only key sizes that are valid for the algorithm will be available, according to the global template policy, the template policy, and the supported key sizes. For PFX and CSR enrollment, you must select a valid Key LengthClosed The key size or key length is the number of bits in a key used by a cryptographic algorithm. and Key TypeClosed The key type identifies the type of key to create when creating a symmetric or asymmetric key. It references the signing algorithm and often key size (e.g. AES-256, RSA-2048, Ed25519). for the enrollment.

Note:  The PopulateMissingValuesFromAD parameter has been removed from the version 2 endpoint.

Table 404: POST Enrollment PFX v2 Input Parameters

Name In Description
Additional Enrollment Fields Body An object that provide values for any custom enrollment fields set on the certificate template to supply custom request attributes to the CA during the enrollment process. For example:
Copy
"AdditionalEnrollmentFields": {
   "CustomStringOne": "MyValue",
   "CustomMultiChoiceOne": "ValueTwo"
}

See Certificate Template Operations for more information.

Certificate Authority Body

Required*. A string that sets the name of the certificate authority that will be used to enroll against if there is more than one available with the provided template name. The certificate authority name can either be provided in hostname\\logical name format or as just the logical name. For example:

corpca01.keyexample.com\\CorpIssuingCA1 OR CorpIssuingCA1

If no certificate authority is provided, one will be chosen at random from the certificate authorities available for enrollment with the provided Template.

This field is optional unless the enrollment is being done against a standalone CA, in which case it is required.

Chain Order Body A string indicating the order in which the certificate chain should be returned if IncludeChain is set to true. Supported values are EndEntityFirst or RootFirst.
Curve Body

A string indicating the elliptic curve for the requested key.

ECC curves may be specified using the well-known OIDs for ECC algorithms. Well-known OIDs include:

  • 1.2.840.10045.3.1.7 = P-256/ prime256v1/ secp256r1

  • 1.3.132.0.34 = P-384/secp384r1

  • 1.3.132.0.35 = P-521/secp521r1

Custom Friendly Name Body

Required*. A string that sets a custom friendly name for the certificate.

This field is required if the Require Custom Friendly Name application setting is set to true (the default is false). See Application Settings: Enrollment Tab for more information.

Include Chain Body

A Boolean that sets whether to include the certificate chain in the response (true) or not (false). The default is true.

Include Subject Header Body

A Boolean that sets whether to include the subject header in the response (true) or not (false). The default is true if not included in the request. Only applicable when PEM format is selected. When set to false, the first line in the PEM file that contains the certificates subject information is removed. When set to true, the first line in the PEM file that contains the certificates subject information is included.

Works with Include Chain option where it will remove the subject header, when set to false, for each of the certificates returned in the chain. It also works with Include Private Key option enabled.

 

Install Into Existing Certificate Stores Body

A Boolean that sets whether to deploy the certificate to certificate stores (true) or not (false). The default is true.

The RenewalCertificateId parameter is used in conjunction with InstallIntoExistingCertificateStores parameter to make the determination as to distribution of the certificate to certificate stores. If InstallIntoExistingCertificateStores is true, the certificate will be distributed to certificate stores that the certificate identified in RenewalCertificateId is found in.

Key Length Body

A string indicating the key size for the requested key. Supported key sizes are:

  • 255
  • 256
  • 384
  • 448
  • 521
  • 2048
  • 3072
  • 4096
  • 8192
KeyType Body

A string indicating the algorithm for the request. Supported values are:

  • RSA

  • ECC

  • Ed448

  • Ed25519

Metadata Body

An object that set the values for the metadata fields that will be associated with the certificate once it is in Keyfactor Command. For example:

Copy
"Metadata": {
   "AppOwnerFirstName": "William",  // This is a String field.
   "AppOwnerLastName": "Smith",
   "AppOwnerEmailAddress": "william.smith@keyexample.com",
   "BusinessCritical": "true",      // This is a Boolean field.
   "BusinessUnit": "E-Business",    // This is a Multiple Choice field with a pre-defined value.
   "Notes": "Here are some notes.", // This is a BigText field.
   "SiteCode": 3,                   // This is an integer field.
   "TicketResolutionDate": "2021-07-23"   // This is a Date field in yyyy-mm-dd format.
}

See Certificate Metadata for more information.

Password Body

Required. A string that sets the password used to encrypt the contents of the PFX file. The minimum password length is controlled by the Password Length application setting. The default is 12. See Application Settings: Enrollment Tab for more information.

Renewal Certificate Id Body

An integer that sets the ID of the certificate to be renewed when the method is called on a certificate renewal.

The RenewalCertificateId parameter is used in conjunction with InstallIntoExistingCertificateStores parameter to make the determination as to distribution of the certificate to certificate stores. If InstallIntoExistingCertificateStores is true, the certificate will be distributed to certificate stores that the certificate identified in RenewalCertificateId is found in.

Stores Body

An array of objects indicating the certificate stores to which the certificate should be distributed. ClosedShow store details.

Subject Body

Required*. A string containing the subject name using X.500 format. For example:

"Subject": "CN=websrvr14.keyexample.com,OU=IT,O=\"Key Example, Inc.\",L=Independence,ST=OH,C=US"

This field is required if the Common Name Regular Expression application setting is set to the default value of .+. See Application Settings: Enrollment Tab for more information.

Timestamp Body Required. A string indicating the current date and time. The date and time should be given using the ISO 8601 UTC time format YYYY-MM-DDTHH:mm:ss.000Z (e.g. 2023-11-19T16:23:01Z).
Template Body

Required*. A string that sets the name of the certificate template that should be used to issue the certificate. The template short name should be used.

This field is required unless the enrollment is being done against a standalone CA.

SANs Body

An object that contains the elements for Keyfactor Command to use when generating the subject alternative name (SAN) for the certificate requested by the CSR, each of which is supplied as an array of strings. ClosedShow SAN key values.

For example:

Copy
"SANs": {
   "dns": [
      "dnssan1.keyexample.com",
      "dnssan2.keyexample.com",
      "dnssan3.keyexample.com"
   ],
   "ip": [
      "192.168.2.73"
   ]
}
Use Legacy Encryption Body A Boolean that sets whether legacy encryption should be used in generating the PKCS#12 file resulting from the enrollment request (true) or not (false). Legacy encryption algorithms include PBE-SHA1-RC2-40 and PBE-SHA1-3DES. When legacy is not selected, encryption algorithms include AES-256-CBC, PBES2 with PBKDF2, and PBE-SHA1-3DES. The default is false.
x-Certificate Format Header

Required. A string containing the desired output format for the certificate. Available options are:

  • JKS

    Select the JKS option when you intend to create a Java keystore with the returned PKCS12Blob.

  • PEM

    Select the PEM option when you intend to create a PEM file with the returned PKCS12Blob.

  • PFX

    Select the PFX option when you intend to create a PKCS#12 (PFX/P12) file with the returned PKCS12Blob.

  • Replace

    The Replace option is designed to be used when pushing an updated certificate to a certificate store (see POST Enrollment PFX Replace). Selecting this item causes data to be staged in preparation for the replace step.

  • Store

    The Store option is designed to be used when pushing a newly obtained certificate to a certificate store (see POST Enrollment PFX Deploy). Selecting this item causes data to be staged in preparation for the deploy step.

  • Zip

    Select the Zip option when you intend to output the returned PKCS12Blob as separate PEM-encoded certificate, private key, and optional chain certificate files wrapped together in a zip file.

Table 405: POST Enrollment PFX v2 Response Data

Value Description
Successful Stores An array of strings containing a comma delimited list of certificate stores, referenced by certificate store GUID, to which the certificate was successfully scheduled for deployment.
Certificate Information

An object containing information about the certificate that was requested. ClosedShow certificate information details.

Metadata

An object containing the custom metadata values set on the certificate. The values vary depending on customization done in your environment. ClosedShow metadata structure details.

See Certificate Metadata for more information.

Version 1 of the POST /Enrollment/PFX method includes the same capabilities as version 2 except when used in conjunction with Keyfactor Command workflows that require approval with an intended end goal of delivering the resulting certificate into a certificate store. In this specific case, version 2 must be used.

Table 406: POST Enrollment PFX v1 Input Parameters

Name In Description
Additional Enrollment Fields Body An object that provides values for any custom enrollment fields set on the certificate template to supply custom request attributes to the CA during the enrollment process. For example:
“AdditionalEnrollmentFields”: { “CustomStringOne”: "MyValue", “CustomMultiChoiceOne”: "ValueTwo" }

See Certificate Template Operations for more information.

Certificate Authority Body

Required*. A string that sets the name of the certificate authority that will be used to enroll against if there is more than one available with the provided template name. The certificate authority name can either be provided in hostname\\logical name format or as just the logical name. For example:

corpca01.keyexample.com\\CorpIssuingCA1 OR CorpIssuingCA1

If no certificate authority is provided, one will be chosen at random from the certificate authorities available for enrollment with the provided Template.

This field is optional unless the enrollment is being done against a standalone CA, in which case it is required.

ChainOrder Body A string indicating the order in which the certificate chain should be returned if IncludeChain is set to true. Supported values are EndEntityFirst or RootFirst.
Custom Friendly Name Body

Required*. A string that sets a custom friendly name for the certificate.

This field is required if the Require Custom Friendly Name application setting is set to true (the default is false). See Application Settings: Enrollment Tab for more information.

Curve Body

A string indicating the elliptic curve for the requested key.

ECC curves may be specified using the well-known OIDs for ECC algorithms. Well-known OIDs include:

  • 1.2.840.10045.3.1.7 = P-256/prime256v1/secp256r1

  • 1.3.132.0.34 = P-384/secp384r1

  • 1.3.132.0.35 = P-521/secp521r1

Include Chain Body

A Boolean that sets whether to include the certificate chain in the response (true) or not (false). The default is true.

Key Length Body

A string indicating the key size for the requested key.

Include Subject Header Body

A Boolean that sets whether to include the subject header in the response (true) or not (false). The default is true if not included in the request. Only applicable when PEM format is selected. When set to false, the first line in the PEM file that contains the certificates subject information is removed. When set to true, the first line in the PEM file that contains the certificates subject information is included.

Works with Include Chain option where it will remove the subject header, when set to false, for each of the certificates returned in the chain. It also works with Include Private Key option enabled.

 

KeyType Body

A string indicating the algorithm for the request. Supported values are:

  • RSA

  • ECC

  • Ed448

  • Ed25519

Metadata Body

An object that set the values for the metadata fields that will be associated with the certificate once it is in Keyfactor Command. The key is the field name and the value is the value for the field. For example:

Copy
"Metadata": {
   "AppOwnerFirstName": "William",  // This is a String field.
   "AppOwnerLastName": "Smith",
   "AppOwnerEmailAddress": "william.smith@keyexample.com",
   "BusinessCritical": "true",      // This is a Boolean field.
   "BusinessUnit": "E-Business",    // This is a Multiple Choice field with a pre-defined value.
   "Notes": "Here are some notes.", // This is a BigText field.
   "SiteCode": 3,                   // This is an integer field.
   "TicketResolutionDate": "2021-07-23"   // This is a Date field in yyyy-mm-dd format.
}

See Certificate Metadata for more information.

Password Body

Required. A string that sets the password used to encrypt the contents of the PFX file. The minimum password length is controlled by the Password Length application setting. The default is 12. See Application Settings: Enrollment Tab for more information.

Populate Missing Values From AD Body

A Boolean that sets whether to populate the information in the subject from Active Directory (true) or not (false). The default is false.

Renewal Certificate Id Body

An integer that sets the ID of the certificate to be renewed when the method is called on a certificate renewal.

SANs Body

An object that contains the elements for Keyfactor Command to use when generating the subject alternative name (SAN) for the certificate requested by the CSR, each of which is supplied as an array of strings. ClosedShow SAN key values.

For example:

Copy
"SANs": {
   "dns": [
      "dnssan1.keyexample.com",
      "dnssan2.keyexample.com",
      "dnssan3.keyexample.com"
   ],
   "ip4": [
      "192.168.2.73"
   ]
}
Subject Body

Required*. A string containing the subject name using X.500 format. For example:

Copy
"Subject": "CN=websrvr14.keyexample.com,OU=IT,O=\"Key Example, Inc.\",L=Independence,ST=OH,C=US"

This field is required if the Common Name Regular Expression application setting is set to the default value of .+. See Application Settings: Enrollment Tab for more information.

Template Body

Required*. A string that sets the name of the certificate template that should be used to issue the certificate. The template short name should be used.

This field is required unless the enrollment is being done against a standalone CA.

Timestamp Body Required. A string indicating the current date and time. The date and time should be given using the ISO 8601 UTC time format YYYY-MM-DDTHH:mm:ss.000Z (e.g. 2023-11-19T16:23:01Z).
Use Legacy Encryption Body A Boolean that sets whether legacy encryption should be used in generating the PKCS#12 file resulting from the enrollment request (true) or not (false). Legacy encryption algorithms include PBE-SHA1-RC2-40 and PBE-SHA1-3DES. When legacy is not selected, encryption algorithms include AES-256-CBC, PBES2 with PBKDF2, and PBE-SHA1-3DES. The default is false.
x-Certificate Format Header

Required. A string containing the desired output format for the certificate. Available options are:

  • JKS

    Select the JKS option when you intend to create a Java keystore with the returned PKCS12Blob.

  • PEM

    Select the PEM option when you intend to create a PEM file with the returned PKCS12Blob.

  • PFX

    Select the PFX option when you intend to create a PKCS#12 (PFX/P12) file with the returned PKCS12Blob.

  • Replace

    The Replace option is designed to be used when pushing an updated certificate to a certificate store (see POST Enrollment PFX Replace). Selecting this item causes data to be staged in preparation for the replace step.

  • Store

    The Store option is designed to be used when pushing a newly obtained certificate to a certificate store (see POST Enrollment PFX Deploy). Selecting this item causes data to be staged in preparation for the deploy step.

  • Zip

    Select the Zip option when you intend to output the returned PKCS12Blob as separate PEM-encoded certificate, private key, and optional chain certificate files wrapped together in a zip file.

Table 407: POST Enrollment PFX v1 Response Data

Value Description
Certificate Information

An object containing information about the certificate that was requested. ClosedShow certificate information details.

Metadata

An object containing the custom metadata values set on the certificate. The values vary depending on customization done in your environment. ClosedShow metadata structure details.

See Certificate Metadata for more information.

Tip:  See the Keyfactor API Reference and Utility which provides a utility through which the Keyfactor APIClosed A set of functions to allow creation of applications. Keyfactor offers the Keyfactor API, which allows third-party software to integrate with the advanced certificate enrollment and management features of Keyfactor Command. endpoints can be called and results returned. It is intended to be used primarily for validation, testing and workflow development. It also serves secondarily as documentation for the API. The link to the Keyfactor API Reference and Utility is in the dropdown from the help icon () at the top of the Management Portal page next to the Log Out button.