Chilkat VB.NET Csp Class Reference
Csp
* This is a freeware class/component/library.
Represents a cryptographic service provider for selecting encryption, hashing, and digital signing algorithms.
Object Creation
(C#)
Chilkat.Csp obj = new Chilkat.Csp();
(VB.NET)
Dim obj As New Chilkat.Csp()
Properties
EncryptAlgorithm As String (ReadOnly)
Returns the name of the currently selected encryption algorithm in the currently selected CSP.
EncryptAlgorithmID As Integer (ReadOnly)
Returns the ID of the currently selected encryption algorithm in the currently selected CSP.
EncryptNumBits As Integer (ReadOnly)
Returns the key-length of the currently selected encryption algorithm in the currently selected CSP.
HashAlgorithm As String (ReadOnly)
Returns the name of the currently selected hash algorithm in the currently selected CSP.
HashAlgorithmID As Integer (ReadOnly)
Returns the ID of the currently selected hash algorithm in the currently selected CSP.
HashNumBits As Integer (ReadOnly)
Returns the bit length of the currently selected hash algorithm in the currently selected CSP.
KeyContainerName As String
The name of the currently selected key container within the currently selected CSP. The default is typically the name of the current logged-in user.
LastErrorHtml As String (ReadOnly)
Error information in HTML format for the last method called.
LastErrorText As String (ReadOnly)
Error information in plain-text format for the last method called.
LastErrorXml As String (ReadOnly)
Error information in XML format for the last method called.
MachineKeyset As Boolean
To be documented soon...
NumEncryptAlgorithms As Integer (ReadOnly)
The number of encryption algorithms provided by the currently selected CSP.
NumHashAlgorithms As Integer (ReadOnly)
The number of hash algorithms provided by the currently selected CSP.
NumKeyContainers As Integer (ReadOnly)
The number of key containers provided by the currently selected CSP.
NumKeyExchangeAlgorithms As Integer (ReadOnly)
The number of key exchange algorithms provided by the currently selected CSP.
NumSignatureAlgorithms As Integer (ReadOnly)
The number of signature algorithms provided by the currently selected CSP.
ProviderName As String
The currently selected CSP. To select another CSP, simply set this property to the name of the CSP, such as "Microsoft Enhanced Cryptographic Provider v1.0". If the CSP is not available on your machine, the property value will not change. The initial and default value for this property is "Microsoft Base Cryptographic Provider v1.0".
ProviderType As Integer (ReadOnly)
This is an integer representing the type of CSP. (Chilkat uses it for internal use.)
Methods
Function GetEncryptionAlgorithm(ByVal index As Integer) As String
Returns the name of the Nth encryption algorithm provided by the currently selected CSP. Indexing begins at 0. Returns Nothing on failure
Function GetEncryptionNumBits(ByVal index As Integer) As Integer
Returns the key-length of the currently selected encryption algorithm in the currently selected CSP.
Function GetHashAlgorithm(ByVal index As Integer) As String
Returns the name of the currently selected hash algorithm in the currently selected CSP. Returns Nothing on failure
Function GetHashNumBits(ByVal index As Integer) As Integer
Returns the bit length of the Nth hash algorithm provided by the currently selected CSP. Indexing begins at 0.
Function GetKeyContainerName(ByVal index As Integer) As String
Returns the Nth key container name in the currently selected CSP. Indexing begins at 0. Returns Nothing on failure
Function GetKeyContainerNames() As StringArray
Returns a string array containing the names of all the key containers in the current CSP. Returns Nothing on failure
Function GetKeyExchangeAlgorithm(ByVal index As Integer) As String
Returns the Nth key exchange algorithm provided by the currently selected CSP. Indexing begins at 0. Returns Nothing on failure
Function GetKeyExchangeNumBits(ByVal index As Integer) As Integer
Returns the bit length of the Nth key exchange algorithm provided by the currently selected CSP. Indexing begins at 0.
Function GetSignatureAlgorithm(ByVal index As Integer) As String
Returns the name of the Nth signature algorithm provided by the currently selected CSP. Indexing begins at 0. Returns Nothing on failure
Function GetSignatureNumBits(ByVal index As Integer) As Integer
Returns the bit length of the Nth signature algorithm provided by the currently selected CSP. Indexing begins at 0.
Function HasEncryptAlgorithm(ByVal name As String, ByVal numBits As Integer) As Boolean
Returns true if the currently selected CSP contains an encryption algorithm matching the name and key length. Otherwise returns false.
Function HasHashAlgorithm(ByVal name As String, ByVal numBits As Integer) As Boolean
Returns true if the currently selected CSP contains a hash algorithm matching the name and bit length. Otherwise returns false.
Function Initialize() As Boolean
Intializes the Csp with the selected ProviderName.
Function SaveLastError(ByVal filename As String) As Boolean
Saves the last error information to an XML formatted file.
Function SetEncryptAlgorithm(ByVal name As String) As Integer
Selects an encryption algorithm. The return value is the key-length of the algorithm. If the algorithm is not available, the return value is 0. (There usually is not a need to explicitly select the key length, because the key length can be part of the name, such as "AES 128", or it is determined by the CSP. For example, the Microsoft Enhanced CSP will return a 128-bit key length for RC2, whereas the Base CSP will return a 40-bit key length.)
Function SetHashAlgorithm(ByVal name As String) As Integer
Selects a hash algorithm. The return value is the bit-length of the algorithm. If the algorithm is not available, the return value is 0.
Function SetProviderMicrosoftBase() As Boolean
Sets the CSP to the Base Microsoft Cryptographic Provider, which is the default.
Function SetProviderMicrosoftEnhanced() As Boolean
Sets the CSP to the Enhanced Microsoft Cryptographic Provider.
Function SetProviderMicrosoftRsaAes() As Boolean
Sets the CSP to the Microsoft Cryptographic RSA/AES Prototype Provider.
Function SetProviderMicrosoftStrong() As Boolean
Sets the CSP to the Strong Microsoft Cryptographic Provider.
|