Chilkat C# Csp Class Reference
Csp
* This is a freeware class/component/library.
Represents a cryptographic service provider for selecting encryption, hashing, and digital signing algorithms.
Properties
public string EncryptAlgorithm {get; }
Returns the name of the currently selected encryption algorithm in the currently selected CSP.
public int EncryptAlgorithmID {get; }
Returns the ID of the currently selected encryption algorithm in the currently selected CSP.
public int EncryptNumBits {get; }
Returns the key-length of the currently selected encryption algorithm in the currently selected CSP.
public string HashAlgorithm {get; }
Returns the name of the currently selected hash algorithm in the currently selected CSP.
public int HashAlgorithmID {get; }
Returns the ID of the currently selected hash algorithm in the currently selected CSP.
public int HashNumBits {get; }
Returns the bit length of the currently selected hash algorithm in the currently selected CSP.
public string KeyContainerName {get; set; }
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.
public string LastErrorHtml {get; }
Error information in HTML format for the last method called.
public string LastErrorText {get; }
Error information in plain-text format for the last method called.
public string LastErrorXml {get; }
Error information in XML format for the last method called.
public bool MachineKeyset {get; set; }
To be documented soon...
public int NumEncryptAlgorithms {get; }
The number of encryption algorithms provided by the currently selected CSP.
public int NumHashAlgorithms {get; }
The number of hash algorithms provided by the currently selected CSP.
public int NumKeyContainers {get; }
The number of key containers provided by the currently selected CSP.
public int NumKeyExchangeAlgorithms {get; }
The number of key exchange algorithms provided by the currently selected CSP.
public int NumSignatureAlgorithms {get; }
The number of signature algorithms provided by the currently selected CSP.
public string ProviderName {get; set; }
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".
public int ProviderType {get; }
This is an integer representing the type of CSP. (Chilkat uses it for internal use.)
Methods
public string GetEncryptionAlgorithm(int index);
Returns the name of the Nth encryption algorithm provided by the currently selected CSP. Indexing begins at 0. Returns a null on failure
public int GetEncryptionNumBits(int index);
Returns the key-length of the currently selected encryption algorithm in the currently selected CSP.
public string GetHashAlgorithm(int index);
Returns the name of the currently selected hash algorithm in the currently selected CSP. Returns a null on failure
public int GetHashNumBits(int index);
Returns the bit length of the Nth hash algorithm provided by the currently selected CSP. Indexing begins at 0.
public string GetKeyContainerName(int index);
Returns the Nth key container name in the currently selected CSP. Indexing begins at 0. Returns a null on failure
public StringArray GetKeyContainerNames();
Returns a string array containing the names of all the key containers in the current CSP.
public string GetKeyExchangeAlgorithm(int index);
Returns the Nth key exchange algorithm provided by the currently selected CSP. Indexing begins at 0. Returns a null on failure
public int GetKeyExchangeNumBits(int index);
Returns the bit length of the Nth key exchange algorithm provided by the currently selected CSP. Indexing begins at 0.
public string GetSignatureAlgorithm(int index);
Returns the name of the Nth signature algorithm provided by the currently selected CSP. Indexing begins at 0. Returns a null on failure
public int GetSignatureNumBits(int index);
Returns the bit length of the Nth signature algorithm provided by the currently selected CSP. Indexing begins at 0.
public bool HasEncryptAlgorithm(string name, int numBits);
Returns true if the currently selected CSP contains an encryption algorithm matching the name and key length. Otherwise returns false.
public bool HasHashAlgorithm(string name, int numBits);
Returns true if the currently selected CSP contains a hash algorithm matching the name and bit length. Otherwise returns false.
public bool Initialize();
Intializes the Csp with the selected ProviderName.
public bool SaveLastError(string filename);
Saves the last error information to an XML formatted file.
public int SetEncryptAlgorithm(string name);
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.)
public int SetHashAlgorithm(string name);
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.
public bool SetProviderMicrosoftBase();
Sets the CSP to the Base Microsoft Cryptographic Provider, which is the default.
public bool SetProviderMicrosoftEnhanced();
Sets the CSP to the Enhanced Microsoft Cryptographic Provider.
public bool SetProviderMicrosoftRsaAes();
Sets the CSP to the Microsoft Cryptographic RSA/AES Prototype Provider.
public bool SetProviderMicrosoftStrong();
Sets the CSP to the Strong Microsoft Cryptographic Provider.
|