ATMI C Function Reference
tpkey_close()
—Closes a previously opened key handle.
#include <atmi.h>
int tpkey_close(TPKEYhKey
, longflags
)
tpkey_close()
releases a previously opened key handle and all resources associated with it. Any sensitive information, such as the principal's private key, is erased from memory.
Key handles can be opened in one of two ways:
It is the application's responsibility to release key resources by calling tpkey_close()
. Once a process closes a key, the process can no longer use the key handle to register a message buffer for digital signature or encryption. If the process opened the key using tpkey_open()
with the TPKEY_AUTOSIGN
or TPKEY_AUTOENCRYPT
flag specified, the key handle no longer applies to future communication operations after the key is closed.
Even though a key is closed, however, the key handle continues to be valid for any associated signature or encryption request registered before the key was closed. When the last buffer associated with a closed key is freed or overwritten, resources attributable to the key are released.
The flags
argument is reserved for future use and must be set to 0.
On failure, this function returns -1 and sets tperrno
to indicate the error condition.
tpenvelope(3c)
, tpkey_getinfo(3c)
, tpkey_open(3c)
, tpkey_setinfo(3c)