/* $Id$ */
/** @file
* Main - Secret key interface.
*/
/*
* Copyright (C) 2015 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include <iprt/memsafer.h>
#include "SecretKeyStore.h"
{
m_cRefs = 0;
m_fRemoveOnSuspend = false;
m_cUsers = 0;
if (RT_SUCCESS(rc))
{
/* Scramble content to make retrieving the key more difficult. */
}
else
throw rc;
}
{
m_cRefs = 0;
m_cbKey = 0;
m_fRemoveOnSuspend = false;
m_cUsers = 0;
}
{
if (cRefs == 1)
{
}
return cRefs;
}
{
if (!cRefs)
{
}
return cRefs;
}
{
return m_cRefs;
}
{
return VINF_SUCCESS;
}
{
return m_cUsers;
}
{
return VINF_SUCCESS;
}
{
return m_fRemoveOnSuspend;
}
{
return m_pbKey;
}
{
return m_cbKey;
}
{
}
{
}
{
/* Check that the ID is not existing already. */
return VERR_ALREADY_EXISTS;
try
{
}
catch (int rc)
{
return rc;
}
return VINF_SUCCESS;
}
{
return VERR_NOT_FOUND;
return VERR_RESOURCE_IN_USE;
delete pKey;
return VINF_SUCCESS;
}
{
return VERR_NOT_FOUND;
return VINF_SUCCESS;
}
{
return VERR_NOT_FOUND;
return VINF_SUCCESS;
}
{
/* First check whether a key is still in use. */
if (!fForce)
{
it++)
{
&& ( ( pKey->getRemoveOnSuspend()
&& fSuspend)
|| !fSuspend))
return VERR_RESOURCE_IN_USE;
}
}
{
if ( pKey->getRemoveOnSuspend()
|| !fSuspend)
{
delete pKey;
}
else
it++;
}
return VINF_SUCCESS;
}