enrollCustomPKCS10_2

The enrollCustomPKCS10_2 sample creates a custom PKCS #10 request and attempts to enroll it in an enterprise certification authority (CA).

Location

When you install the Microsoft Windows Software Development Kit (SDK), the sample is installed by default in the %ProgramFiles%\Microsoft SDKs\Windows\v7.0\Samples\Security\X509 Certificate Enrollment\VC\enrollCustomPKCS10_2 folder.

Discussion

The enrollCustomPKCS10_2 sample:

  1. Processes the command line arguments. The command line should contain the name of a template and the name of a cryptographic provider.
  2. Creates an IX509Enrollment object and initializes it by using the name of the template specified on the command line.
  3. Retrieves the certificate request from the enrollment object.
  4. Retrieves the innermost PKCS#10 request from the certificate request object obtained in step 3.
  5. Retrieves a private key from the PKCS#10 request.
  6. Creates an ICspInformations collection and adds the available cryptographic providers to the collection and then retrieves an ICspStatus object for the provider specified on the command line.
  7. Sets the status object on the private key.
  8. Attempts to enroll the certificate request.

PKCS #10 Request

Using the Included Samples