To work with the algorithms, several functions are available to map algorithm names to the internal identifiers, as well as ways to retrieve information about an algorithm or the current cipher context.
This function is used to retrieve information on a specific algorithm. You pass the cipher algorithm ID as algo and the type of information requested as what. The result is either returned as the return code of the function or copied to the provided buffer whose allocated length must be available in an integer variable with the address passed in nbytes. This variable will also receive the actual used length of the buffer.
Here is a list of supported codes for what:
- Return the length of the key. If the algorithm supports multiple key lengths, the maximum supported value is returned. The length is returned as number of octets (bytes) and not as number of bits in nbytes; buffer must be zero.
- Return the block length of the algorithm. The length is returned as a number of octets in nbytes; buffer must be zero.
0when the specified algorithm is available for use. buffer and nbytes must be zero.
gcry_cipher_algo_namereturns a string with the name of the cipher algorithm algo. If the algorithm is not known or another error occurred, the string
"?"is returned. This function should not be used to test for the availability of an algorithm.
gcry_cipher_map_namereturns the algorithm identifier for the cipher algorithm described by the string name. If this algorithm is not available
Return the cipher mode associated with an ASN.1 object identifier. The object identifier is expected to be in the IETF-style dotted decimal notation. The function returns
0for an unknown object identifier or when no mode is associated with it.