UID | title | description | helpviewer_keywords | old-location | tech.root | ms.assetid | ms.date | ms.keywords | req.header | req.include-header | req.target-type | req.target-min-winverclnt | req.target-min-winversvr | req.kmdf-ver | req.umdf-ver | req.ddi-compliance | req.unicode-ansi | req.idl | req.max-support | req.namespace | req.assembly | req.type-library | req.lib | req.dll | req.irql | targetos | req.typenames | req.redist | ms.custom | f1_keywords | dev_langs | topic_type | api_type | api_location | api_name | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NF:xenroll.ICEnroll.createFilePKCS10 |
ICEnroll::createFilePKCS10 (xenroll.h) |
Creates a base64-encoded PKCS (ICEnroll.createFilePKCS10) |
|
security\icenroll4_createfilepkcs10.htm |
security |
074c7321-6117-4261-836a-a2055c9e029d |
12/05/2018 |
CEnroll object [Security],createFilePKCS10 method, ICEnroll interface [Security],createFilePKCS10 method, ICEnroll.createFilePKCS10, ICEnroll2 interface [Security],createFilePKCS10 method, ICEnroll2::createFilePKCS10, ICEnroll3 interface [Security],createFilePKCS10 method, ICEnroll3::createFilePKCS10, ICEnroll4 interface [Security],createFilePKCS10 method, ICEnroll4::createFilePKCS10, ICEnroll::createFilePKCS10, createFilePKCS10, createFilePKCS10 method [Security], createFilePKCS10 method [Security],CEnroll object, createFilePKCS10 method [Security],ICEnroll interface, createFilePKCS10 method [Security],ICEnroll2 interface, createFilePKCS10 method [Security],ICEnroll3 interface, createFilePKCS10 method [Security],ICEnroll4 interface, security.icenroll4_createfilepkcs10, xenroll/ICEnroll2::createFilePKCS10, xenroll/ICEnroll3::createFilePKCS10, xenroll/ICEnroll4::createFilePKCS10, xenroll/ICEnroll::createFilePKCS10 |
xenroll.h |
Windows |
Windows XP [desktop apps only] |
Windows Server 2003 [desktop apps only] |
Uuid.lib |
Xenroll.dll |
Windows |
19H1 |
|
|
|
|
|
|
[This method is no longer available for use as of Windows Server 2008 and Windows Vista.]
The createFilePKCS10 method creates a base64-encoded PKCS #10 certificate request and saves it in a file. This method was first defined in the ICEnroll interface.
This method differs from the createPKCS10 method only in saving the base64-encoded PKCS #10 certificate request (in BSTR form) to the file specified by the wszPKCS10FileName parameter.
The distinguished name (DN) of the entity for which the request is being made. DNName must follow the X.500 naming convention. For example "CN=User, O=Microsoft". If a two-letter prefix does not exist, an object identifier (OID) may be provided instead.
An OID that describes the purpose of the certificate being generated, for example, individual or commercial Authenticode certificate, or client authentication. You can also specify multiple OIDs separated by a comma.
The OID is passed through to the PKCS #10 request. The control does not examine the OID.
The name of the file in which the base64-encoded PKCS #10 (in BSTR form) is saved. The contents of this file may be submitted to a certification authority for processing.
The return value is an HRESULT. A value of S_OK indicates success.If the method fails, the return value is an HRESULT indicating the error. For a list of common error codes, see Common HRESULT Values.
By default, the Microsoft Base Cryptographic Provider is used, and a unique signature key is created.
When this method is called from script, the method displays a user interface that asks whether the user will allow creation of a certificate request and whether the user will allow a write operation to the file system.
BSTR bstrDN = NULL;
BSTR bstrOID = NULL;
BSTR bstrFileName = NULL;
ICEnroll4 * pEnroll = NULL;
HRESULT hr;
hr = CoInitializeEx( NULL, COINIT_APARTMENTTHREADED );
if (FAILED(hr))
{
printf("Failed CoInitializeEx - %x\n", hr);
goto error;
}
hr = CoCreateInstance( __uuidof(CEnroll),
NULL,
CLSCTX_INPROC_SERVER,
__uuidof(ICEnroll4),
(void **)&pEnroll);
if (FAILED(hr))
{
printf("Failed CoCreateInstance - pEnroll [%x]\n", hr);
goto error;
}
// Generate the DN for the cert request.
bstrDN = SysAllocString( TEXT("CN=Your Name") // common name
TEXT(",OU=Your Unit") // org unit
TEXT(",O=Your Org") // organization
TEXT(",L=Your City") // locality
TEXT(",S=Your State") // state
TEXT(",C=Your Country") ); // country/region
if (NULL == bstrDN)
{
printf("Memory allocation failed for bstrDN.\n");
goto error;
}
// Generate the OID. For example, "1.3.6.1.4.1.311.2.1.21"
bstrOID = SysAllocString(TEXT("<OIDHERE>"));
if (NULL == bstrOID)
{
printf("Memory allocation failed for bstrOID.\n");
goto error;
}
// Specify the file name, for example, "myPKCS10.req"
bstrFileName = SysAllocString(TEXT("<FILENAMEHERE>"));
if (NULL == bstrFileName)
{
printf("Memory allocation failed for bstrFileName.\n");
goto error;
}
// Create the PKCS10 (stored in a file).
hr = pEnroll->createFilePKCS10( bstrDN, bstrOID, bstrFileName );
if (FAILED(hr))
{
printf("Failed createFilePKCS10 - %x\n", hr);
goto error;
}
else
printf("Successfully created file containing PKCS10\n");
error:
// Clean up resources and so on.
if ( bstrFileName )
SysFreeString( bstrFileName );
if ( bstrDN )
SysFreeString( bstrDN );
if ( bstrOID )
SysFreeString( bstrOID );
if ( pEnroll )
pEnroll->Release();
CoUninitialize();