![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(SQL Server) Verify the Timestamp Server Token (if any) while Validating a CMS SignatureDemonstrates how to also validate the timestamp server token (if any) while validating a CMS signature.
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls. -- CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int -- Important: Do not use nvarchar(max). See the warning about using nvarchar(max). DECLARE @sTmp0 nvarchar(4000) DECLARE @crypt int EXEC @hr = sp_OACreate 'Chilkat.Crypt2', @crypt OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END -- Tell Chilkat to also validate the timestamp token if a timestamp exists in the CMS message's unauthenticated attributes. DECLARE @cmsOptions int EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @cmsOptions OUT DECLARE @success int EXEC sp_OAMethod @cmsOptions, 'UpdateBool', @success OUT, 'ValidateTimestampTokens', 1 EXEC sp_OAMethod @cmsOptions, 'Emit', @sTmp0 OUT EXEC sp_OASetProperty @crypt, 'CmsOptions', @sTmp0 DECLARE @outputFile nvarchar(4000) SELECT @outputFile = 'qa_output/original.xml' DECLARE @inFile nvarchar(4000) SELECT @inFile = 'qa_data/p7m/fattura_signature.xml.p7m' -- Verify the signature and extract the contained file, which in this case is XML. DECLARE @success int EXEC sp_OAMethod @crypt, 'VerifyP7M', @success OUT, @inFile, @outputFile IF @success = 0 BEGIN EXEC sp_OAGetProperty @crypt, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @crypt EXEC @hr = sp_OADestroy @cmsOptions RETURN END PRINT 'Signature validated.' EXEC @hr = sp_OADestroy @crypt EXEC @hr = sp_OADestroy @cmsOptions END GO |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.