我正在使用以下代码将证书作为受信任的根导入:
#include "stdafx.h"
#include "windows.h"
#include "Cryptuiapi.h"
#pragma comment(lib, "Cryptui.lib")
int _tmain(int argc, _TCHAR* argv[]){
CRYPTUI_WIZ_IMPORT_SRC_INFO importSrc;
memset(&importSrc, 0, sizeof(CRYPTUI_WIZ_IMPORT_SRC_INFO));
importSrc.dwSize = sizeof(CRYPTUI_WIZ_IMPORT_SRC_INFO);
importSrc.dwSubjectChoice = CRYPTUI_WIZ_IMPORT_SUBJECT_FILE;
importSrc.pwszFileName = L“C:\\PathToCert\\MyCertificate.cer”;
importSrc.pwszPassword = L"";
importSrc.dwFlags = CRYPT_EXPORTABLE | CRYPT_USER_PROTECTED;
if (CryptUIWizImport(
CRYPTUI_WIZ_NO_UI,
NULL,
NULL,
&importSrc,
NULL
) == 0)
{
printf(“CryptUIWizImport error 0x%x\n”, GetLastError());
}
return 0;
}
但是,这种方法会导入我的证书,Intermediate Certificate Authorities
而我需要将其导入为Trusted Root Certificate Authorities
. 我不想使用任何向导方法,也无法更改我的证书。
是否可以将此证书作为受信任的根导入?
是否有任何属性CryptUIWizImport
可以将证书类型设置为受信任的根?
提前感谢