catpsd_openpsd - open a Virtual Card
#include <cat/cat.h>
int catpsd_openpsd(char *psd, cat_psd **handle, const char *pin, int flags);
This function opens a Virtual Card using a password and returns a handle.
psd is the Virtual Card encoded in base64. By default this will be copied by
the library.
Handle is a pointer to the location where the handle to the open Virtual Card will
be placed.
pin is the password of the Virtual Card defined as a string.
Flags can contain combinations of the following values, ORed together bitwise:
- CATPSD_DEFEROPEN
-
The Virtual Card will not be opened until it is needed. The handle can be used with other catpsd functions, such as catpsd_setpsd, and the Virtual Card will be opened when needed.
- CATPSD_BOKSPSD
-
The Virtual Card is a Keon 4.5 (BoKS) Agent Host Virtual Card, in which pin, which defines the password, has been hashed. The function tries to open
the Virtual Card with a hashed and unhashed PIN, and the Virtual Card will
be opened (provided the password is correct), but using this flag
determines the order and means that the Virtual Card may be opened more
quickly.
- CATPSD_NOCOPY
-
The psd buffer will not be copied but becomes the property of the library. If this
option is used, psd should be dynamically allocated and it must not be freed by the caller.
If handle is NULL
, the only check carried out is that the supplied PIN can open the Virtual
Card.
The function returns a zero or positive value when successful, and a
negative error code on error. A return code of CATPSD_BOKSPSD
indicates that the Virtual Card was opened using the BoKS method.
catpsd