Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(SQL Server) List CSP's (Cryptographic Service Providers) on a Windows SystemList the CSP's registered on a Windows system. Note: This example requires Chilkat v9.5.0.77 or greater.
-- 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 @csp int -- Use "Chilkat_9_5_0.Csp" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.Csp', @csp OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END DECLARE @st int -- Use "Chilkat_9_5_0.StringTable" for versions of Chilkat < 10.0.0 EXEC @hr = sp_OACreate 'Chilkat.StringTable', @st OUT DECLARE @success int EXEC sp_OAMethod @csp, 'GetProviders', @success OUT, @st IF @success = 0 BEGIN EXEC sp_OAGetProperty @csp, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @csp EXEC @hr = sp_OADestroy @st RETURN END -- Iterate over the CSP names.. DECLARE @i int SELECT @i = 0 DECLARE @numProviders int EXEC sp_OAGetProperty @st, 'Count', @numProviders OUT WHILE @i < @numProviders BEGIN EXEC sp_OAMethod @st, 'StringAt', @sTmp0 OUT, @i PRINT @i + ': ' + @sTmp0 SELECT @i = @i + 1 END -- Sample output: -- -- 0: Microsoft Base Cryptographic Provider v1.0 -- 1: Microsoft Base DSS and Diffie-Hellman Cryptographic Provider -- 2: Microsoft Base DSS Cryptographic Provider -- 3: Microsoft Base Smart Card Crypto Provider -- 4: Microsoft DH SChannel Cryptographic Provider -- 5: Microsoft Enhanced Cryptographic Provider v1.0 -- 6: Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider -- 7: Microsoft Enhanced RSA and AES Cryptographic Provider -- 8: Microsoft RSA SChannel Cryptographic Provider -- 9: Microsoft Strong Cryptographic Provider -- EXEC @hr = sp_OADestroy @csp EXEC @hr = sp_OADestroy @st END GO |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.