서명 관리자 초기화
이 항목에서는 XPS 문서에서 사용할 서명 관리자를 초기화하는 방법을 설명합니다.
프로그램에서 다음 코드 예제를 사용하기 전에 Common Digital Signature Programming Tasks의 고지 사항을 읽어 줍니다.
Crypto API의 Windows 7 기능을 사용하려면 다음과 같이 CRYPT_OID_INFO_HAS_EXTRA_FIELDS 기호를 정의합니다.
#define CRYPT_OID_INFO_HAS_EXTRA_FIELDS
다음으로, 다음 코드 예제와 같이 CoCreateInstance를 호출하여 IXpsSignatureManager 인터페이스를 인스턴스화합니다.
IXpsSignatureManager *newInterface;
// Note the implicit requirement that CoInitializeEx
// has previously been called from this thread.
hr = CoCreateInstance(
__uuidof(XpsSignatureManager),
NULL,
CLSCTX_INPROC_SERVER,
__uuidof(IXpsSignatureManager),
reinterpret_cast<LPVOID*>(&newInterface));
// make sure that you got a pointer
// to the interface
if (SUCCEEDED(hr)) {
// Load document into signature manager from file.
// xpsDocument is initialized with the file name
// of the document to load outside of this example.
hr = newInterface->LoadPackageFile (xpsDocument);
// Use newInterface
// Release interface pointers when finished with them
newInterface->Release();
}
CoCreateInstance에서 인스턴스화된 인터페이스는 다른 메서드를 호출하기 전에 LoadPackageFile 또는 LoadPackageStream을 호출하여 로드해야 하는 하나의 XPS 문서에서만 사용할 수 있습니다.
IXpsSignatureManager 인터페이스가 인스턴스화되고 XPS 문서가 로드되면 서명 관리자를 사용할 준비가 됩니다.
관련 항목
-
다음 단계
-
이 섹션에서 사용됨
-
상세 설명