CkoCsp Objective-C Reference Documentation

CkoCsp

Represents a cryptographic service provider for selecting encryption, hashing, and digital signing algorithms.

This class is specific to the Windows operating system, and therefore is only available on Windows systems.

Properties

- (NSString *)DebugLogFilePath

- (void)setDebugLogFilePath: (NSString *)input

If set to a file path, causes each Chilkat method or property call to automatically append it's LastErrorText to the specified log file. The information is appended such that if a hang or crash occurs, it is possible to see the context in which the problem occurred, as well as a history of all Chilkat calls up to the point of the problem. The VerboseLogging property can be set to provide more detailed information.

This property is typically used for debugging the rare cases where a Chilkat method call hangs or generates an exception that halts program execution (i.e. crashes). A hang or crash should generally never happen. The typical causes of a hang are:

  1. a timeout related property was set to 0 to explicitly indicate that an infinite timeout is desired,
  2. the hang is actually a hang within an event callback (i.e. it is a hang within the application code), or
  3. there is an internal problem (bug) in the Chilkat code that causes the hang.

- (NSString *)EncryptAlgorithm

Returns the name of the currently selected encryption algorithm in the currently selected CSP.

- (NSNumber *)EncryptAlgorithmID

Returns the ID of the currently selected encryption algorithm in the currently selected CSP.

- (NSNumber *)EncryptNumBits

Returns the key-length of the currently selected encryption algorithm in the currently selected CSP.

- (NSString *)HashAlgorithm

Returns the name of the currently selected hash algorithm in the currently selected CSP.

- (NSNumber *)HashAlgorithmID

Returns the ID of the currently selected hash algorithm in the currently selected CSP.

- (NSNumber *)HashNumBits

Returns the bit length of the currently selected hash algorithm in the currently selected CSP.

- (NSString *)LastErrorHtml

Provides information in HTML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

- (NSString *)LastErrorText

Provides information in plain-text format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

Concept of LastErrorText

LastErrorText Standard Information

- (NSString *)LastErrorXml

Provides information in XML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

- (NSNumber *)NumEncryptAlgorithms

The number of encryption algorithms provided by the currently selected CSP.

- (NSNumber *)NumHashAlgorithms

The number of hash algorithms provided by the currently selected CSP.

- (NSNumber *)NumKeyContainers

The number of key containers provided by the currently selected CSP.

- (NSNumber *)NumKeyExchangeAlgorithms

The number of key exchange algorithms provided by the currently selected CSP.

- (NSNumber *)NumSignatureAlgorithms

The number of signature algorithms provided by the currently selected CSP.

- (NSString *)ProviderName

- (void)setProviderName: (NSString *)input

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".

- (NSNumber *)ProviderType

This is an integer representing the type of CSP. (Chilkat uses it for internal use.)

- (BOOL)VerboseLogging

- (void)setVerboseLogging: (BOOL)boolVal

If set to YES, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is NO. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.

- (NSString *)Version

Version of the component/library, such as "9.4.1.42"

Methods

- (CkoStringArray *)GetKeyContainerNames

To be documented soon...

- (BOOL)HasEncryptAlgorithm

Returns true if the currently selected CSP contains an encryption algorithm matching the name and key length. Otherwise returns false.

- (BOOL)HasHashAlgorithm

Returns true if the currently selected CSP contains a hash algorithm matching the name and bit length. Otherwise returns false.

- (BOOL)Initialize

Intializes the Csp with the selected ProviderName.

- (NSString *)NthEncryptionAlgorithm

Returns the name of the Nth encryption algorithm provided by the currently selected CSP. Indexing begins at 0.

Returns nil on failure

- (NSNumber *)NthEncryptionNumBits

Returns the key-length of the currently selected encryption algorithm in the currently selected CSP.

- (NSString *)NthHashAlgorithmName

To be documented soon...

Returns nil on failure

- (NSNumber *)NthHashNumBits

Returns the bit length of the Nth hash algorithm provided by the currently selected CSP. Indexing begins at 0.

- (NSString *)NthKeyContainerName

Returns the Nth key container name in the currently selected CSP. Indexing begins at 0.

Returns nil on failure

- (NSString *)NthKeyExchangeAlgorithm

Returns the Nth key exchange algorithm provided by the currently selected CSP. Indexing begins at 0.

Returns nil on failure

- (NSNumber *)NthKeyExchangeNumBits

Returns the bit length of the Nth key exchange algorithm provided by the currently selected CSP. Indexing begins at 0.

- (NSString *)NthSignatureAlgorithm

Returns the name of the Nth signature algorithm provided by the currently selected CSP. Indexing begins at 0.

Returns nil on failure

- (NSNumber *)NthSignatureNumBits

Returns the bit length of the Nth signature algorithm provided by the currently selected CSP. Indexing begins at 0.

- (BOOL)SaveLastError:(NSString *)path

Saves the last-error information (the contents of LastErrorXml) to an XML formatted file.

Returns true for success, false for failure.

- (NSNumber *)SetEncryptAlgorithm

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.)

- (NSNumber *)SetHashAlgorithm

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.

- (BOOL)SetProviderMicrosoftBase

Sets the CSP to the Base Microsoft Cryptographic Provider, which is the default.

- (BOOL)SetProviderMicrosoftEnhanced

Sets the CSP to the Enhanced Microsoft Cryptographic Provider.

- (BOOL)SetProviderMicrosoftRsaAes

Sets the CSP to the Microsoft Cryptographic RSA/AES Prototype Provider.

- (BOOL)SetProviderMicrosoftStrong

Sets the CSP to the Strong Microsoft Cryptographic Provider.