既懂VB又懂C++的哥们请进(答对后,立即给分)
哪位能用C++翻译一下!
为什么MSDN只有VB的Code!
Sub VerifySig(ByVal FileToVerify As String, ByVal FileBase As String)
On Error GoTo ErrorHandler
Dim sdContent As String
Dim sdCheck As String
Dim mySD As SignedData
Set mySD = New SignedData
' Open a file and read the signature.
Open FileToVerify For Input As #1
Input #1, sdCheck
Close #1
' Open a file and input the plaintext content that was signed.
Open FileBase For Input As #2
Input #2, sdContent
Close #1
' Set the detached content upon which the signature is based.
mySD.Content = sdContent
' Verify the detached signature.
On Error Resume Next
mySD.Verify sdCheck, True
If Err.Number <> 0 Then
MsgBox "Signature verification failed. " & Err.Description
Else
MsgBox "Verification complete."
End If
' Release the SignedData object.
Set mySD = Nothing
Exit Sub
ErrorHandler:
If Err.Number > 0 Then
MsgBox "VB Error found: " & Err.Description
Else
MsgBox "CAPICOM error found: " & Hex(Err.Number)
End If
End Sub