![]() |
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) Example: Crypt2.SetSigningCert methodDemonstrates how to call the SetSigningCert method.
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls. -- CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int -- Signing certificates can be obtained from many different sources.. -- Load from a PFX DECLARE @cryptA int EXEC @hr = sp_OACreate 'Chilkat.Crypt2', @cryptA OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END DECLARE @certA int EXEC @hr = sp_OACreate 'Chilkat.Cert', @certA OUT DECLARE @success int EXEC sp_OAMethod @certA, 'LoadPfxFile', @success OUT, 'c:/someDir/pfx_files/a.pfx', 'pfx_file_password' EXEC sp_OAMethod @cryptA, 'SetSigningCert', @success OUT, @certA -- ... -- Load from a smart card or USB token. DECLARE @cryptB int EXEC @hr = sp_OACreate 'Chilkat.Crypt2', @cryptB OUT DECLARE @certB int EXEC @hr = sp_OACreate 'Chilkat.Cert', @certB OUT EXEC sp_OASetProperty @certB, 'SmartCardPin', '123456' EXEC sp_OAMethod @certB, 'LoadFromSmartcard', @success OUT, '' EXEC sp_OAMethod @cryptB, 'SetSigningCert', @success OUT, @certB -- ... -- Load from a the Windows certificate store or macOS keychain DECLARE @cryptC int EXEC @hr = sp_OACreate 'Chilkat.Crypt2', @cryptC OUT DECLARE @certC int EXEC @hr = sp_OACreate 'Chilkat.Cert', @certC OUT EXEC sp_OAMethod @certC, 'LoadByCommonName', @success OUT, 'Xyz 123' EXEC sp_OAMethod @cryptC, 'SetSigningCert', @success OUT, @certC -- ... EXEC @hr = sp_OADestroy @cryptA EXEC @hr = sp_OADestroy @certA EXEC @hr = sp_OADestroy @cryptB EXEC @hr = sp_OADestroy @certB EXEC @hr = sp_OADestroy @cryptC EXEC @hr = sp_OADestroy @certC END GO |
||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.