C-C++ Source: setDebugOutput.cpp, DBStream.h, and DBStream.cpp
[This sample code uses features that were implemented in MSXML 5.0 for Microsoft Office Applications. XML digital signatures are not supported in MXSML 6.0 and later.]
The source code consists of the following three files.
Source file | Description |
---|---|
setDebugOutput.cpp | Main program that instantiates a DBStream object, sets it on the IXMLDigitalSignature object to receive debug output, and calls sign /verify on IXMLDigitalSignature . |
DBStream.h | Header file for the DBStream class. |
DBStream.cpp | Class implementation of DBStream . |
Try It!
Ensure that you have completed all the procedures in Getting Started with XML Digital Signatures.
Start Visual C++.
From the File menu, select New. On the Projects tab of the New dialog box that appears, select Win32 Console Application in the left pane. Then type "setDebugOutputProj" in the Project name field. For the project Location field, either accept the default setting or choose another location. Click OK.
The Win32 Console Application property page will appear. For the type of Console Application, select An empty project and click Finish. When the New Project Information box displays, click OK.
Select FileView on the project browser, and highlight setDebugOutputProj files. From the File menu, select New.
On the Files tab of the New dialog box, highlight C++ Source File. Then type "signature.template.xml" in the File name text box.
Click OK.
Copy the XML signature template file from Resource: signature.template.xml, and paste it into the text file you just created.
Note
You can also copy the file into the project's main directory using Windows Explorer (or a command prompt).
Repeat steps 5-8 for the setDebugOutput.cpp C++ file.
Repeat steps 5-8 for the DBStream.h header file.
Repeat steps 5-8 for the setDebugOutput.cpp C++ file.
From the Project menu, click Settings..., then click the Link tab.
In Object/library modules, type "crypt32.lib". Insert this text either before or after the existing string that lists all objects and modules for the current project. Then click OK.
Build the sample by selecting Build setDebugOutputProj.exe from the Build menu.
Execute the sample application by selecting !Execute setDebugOutputProj.exe from the Build menu.
Verify that you get output similar to that listed in the Output topic at the end of this example.