GET_ENCRYPTION_STATE
This IOCTL command queries the drive's encryption method and state.
The data structure that is used for this IOCTL is as follows on all
of the supported operating systems
struct encryption_status
{
uchar encryption_capable; /* (1)Set this field as a boolean based on the
capability of the drive */
uchar encryption_method; /* (2)Set this field to one of the following */
#define METHOD_NONE 0 /* Only used in GET_ENCRYPTION_STATE */
#define METHOD_LIBRARY 1 /* Only used in GET_ENCRYPTION_STATE */
#define METHOD_SYSTEM 2 /* Only used in GET_ENCRYPTION_STATE */
#define METHOD_APPLICATION 3 /* Only used in GET_ENCRYPTION_STATE */
#define METHOD_CUSTOM 4 /* Only used in GET_ENCRYPTION_STATE */
#define METHOD_UNKNOWN 5 /* Only used in GET_ENCRYPTION_STATE */
uchar encryption_state; /* (3) Set this field to one of the following */
#define STATE_OFF 0 /* Used in GET/SET_ENCRYPTION_STATE */
#define STATE_ON 1 /* Used in GET/SET_ENCRYPTION_STATE */
#define STATE_NA 2 /* Only used in GET_ENCRYPTION_STATE*/
uchar[13] reserved;
};
An example of the GET_ENCRYPTION_STATE command
is
int qry_encrytion_state (void)
{
int rc = 0;
struct encryption_status encryption_status_t;
printf("issuing query encryption status...\n");
memset(,&encryption_status_t 0, sizeof(struct encryption_status));
rc = ioctl(fd, GET_ENCRYPTION_STATE, );&encryption_status_t
if(rc == 0)
{
if(encryption_status_t.encryption_capable)
printf("encryption capable......Yes\n");
else
printf("encryption capable......No\n");
switch(encryption_status_t.encryption_method)
{
case METHOD_NONE:
printf("encryption method.......METHOD_NONE\n");
break;
case METHOD_LIBRARY:
printf("encryption method.......METHOD_LIBRARY\n");
break;
case METHOD_SYSTEM:
printf("encryption method.......METHOD_SYSTEM\n");
break;
case METHOD_APPLICATION:
printf("encryption method.......METHOD_APPLICATION\n");
break;
case METHOD_CUSTOM:
printf("encyrpiton method.......METHOD_CUSTOM\n");
break;
case METHOD_UNKNOWN:
printf("encryption method.......METHOD_UNKNOWN\n");
break;
default:
printf("encrption method.......Error\n");
}
switch(encryption_status_t.encryption_state)
{
case STATE_OFF:
printf("encryption state........OFF\n");
break;
case STATE_ON:
printf("encryption state........ON\n");
break;
case STATE_NA:
printf("encryption state........NA\n");
break;
default:
printf("encryption state......Error\n");
}
}
return rc;
}