Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Verify .p7s and Extract Original FileSQL Server example to verify and unpack the contents of a .p7s to restore the original file.
CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int 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 -- Any string argument automatically begins the 30-day trial. DECLARE @success int EXEC sp_OAMethod @crypt, 'UnlockComponent', @success OUT, '30-day trial' IF @success <> 1 BEGIN PRINT 'Crypt component unlock failed' RETURN END -- Find our digital certificate from the Current User certificate store. DECLARE @ccs int EXEC @hr = sp_OACreate 'Chilkat.CreateCS', @ccs OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END DECLARE @certStore int EXEC sp_OAMethod @ccs, 'OpenCurrentUserStore', @certStore OUT DECLARE @cert int EXEC sp_OAMethod @certStore, 'FindCertBySubjectCN', @cert OUT, 'Chilkat Software, Inc.' IF @cert Is NULL BEGIN EXEC sp_OAGetProperty @cert, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 RETURN END -- Verify and restore the original file: EXEC sp_OAMethod @crypt, 'SetVerifyCert', NULL, @cert EXEC sp_OAMethod @crypt, 'VerifyP7S', @success OUT, 'license.p7s', 'license2.rtf' IF @success = 0 BEGIN EXEC sp_OAGetProperty @crypt, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 RETURN END PRINT 'Success!' END GO |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2007 Chilkat Software, Inc. All Rights Reserved.