Partager via


How to Serialize a Certificate from a PFX File

Applies To: System Center Configuration Manager 2007, System Center Configuration Manager 2007 R2, System Center Configuration Manager 2007 R3, System Center Configuration Manager 2007 SP1, System Center Configuration Manager 2007 SP2

In Microsoft System Center Configuration Manager 2007 you serialize a certificate from a PFX file by calling the PxeAuthClass Client COM Automation ClassIPxeAuthClass::ReadIdentity Method method.

ReadIdentity has the following parameters:

Parameter Description

FileName

The path and filename of the PFX file.

FilePassword

The PFX file password.

SMSID

The PXE certificate identifier.

ReadIdentity returns an array containing the following:

Element Description

0

The hexadecimal-encoded private key for the PFX file containing the certificate.

1

The hexadecimal-encoded certificate.

After you obtain the array, you can use it to submit a registration record by using the SMS_Site class SubmitRegistrationRecord method.

To serialize a certificate from a PFX file

  1. Create an instance of the PxeAuthClass Client COM Automation Class class.

  2. Call the ReadIdentity method.

Example

The following example reads a certificate from a file identified by fileName.

For information about calling the sample code, see How to Call Configuration Manager COM Automation Objects.

Sub SerializeCertFromPFX (fileName, password, smsID)


    Dim pxeauth
    Set pxeauth = CreateObject("Microsoft.ConfigMgr.PXEAuth")

   
    ' Serialize certificate from PFX file.
    

    Dim ident

    ident= pxeauth.ReadIdentity( fileName, password, smsID)
    WScript.Echo "certificatePFX = " & ident(0)
    WScript.Echo "certificate    = " & ident(1)

End Sub

The example method has the following parameters:

Parameter Type Description

fileName

  • VBScript: String

The name and path for the PFX file. For example, \\SERVERNAME\c$\SelfSigned.pfx.

password

  • VBScript: String

The PFX file password.

smsID

  • VBScript: String

The PXE certificate identifier.

Compiling the Code

Platforms

Windows Server 2003

To use PXEAuthClass with C# you will need the following:

Namespaces

System

System.Collections.Generic

System.Text

System.Threading

TsMediaLib

Assembly

You will need to use COM interop to access the TSMediaClass object. The COM object you add a reference to is TSMedia 1.0 Type Library.

To declare in your code, using PxeAuthClassClass.

Robust Programming

For more information about error handling, see About Configuration Manager Errors.

Security

For more information about securing Configuration Manager applications, see About Securing Configuration Manager Applications.

See Also

Concepts

About Operating System Deployment Media Management
How to Create Capture Media
How to Create Boot Media
How to Create Stand-Alone Operating System Media
How to Create and Serialize a New Self-Signed Certificate
PxeAuthClass Client COM Automation Class