Additional changes for binary secrets

This commit is contained in:
Jim Norman 2005-12-12 20:50:52 +00:00
parent 08038f4b7f
commit 8f36de6bc7

View File

@ -2711,7 +2711,8 @@ miCASAGetCredential
if (*credentialType == SSCS_CRED_TYPE_BINARY_F)
{
return miCASAReadBinaryKey(
// first check appSecretID
rcode = miCASAReadBinaryKey(
context,
ssFlags,
&kc,
@ -2723,6 +2724,26 @@ miCASAGetCredential
NULL,
&bytesRequired,
ext);
if ((rcode != NSSCS_SUCCESS) && (sharedSecretID != NULL))
{
// try shared if set
rcode = miCASAReadBinaryKey(
context,
ssFlags,
&kc,
sharedSecretID,
binaryCred->id,
binaryCred->idLen,
binaryCred->data,
binaryCred->dataLen,
NULL,
&bytesRequired,
ext);
}
miCASACloseSecretStoreCache(context, ssFlags, NULL);
return rcode;
}
// create a SHS Handle
@ -2882,6 +2903,12 @@ miCASASetCredential
SSCS_BASIC_CREDENTIAL *basicCred;
SSCS_BINARY_CREDENTIAL *binaryCred;
// check params
if ((appSecretID == NULL) || (credential == NULL))
{
return(NSSCS_E_INVALID_PARAM);
}
// open secretStore
sscs_Utf8Strcpy(store.ssName, SSCS_DEFAULT_SECRETSTORE_ID);
store.version = 1;
@ -2903,7 +2930,11 @@ miCASASetCredential
{
binaryCred = (SSCS_BINARY_CREDENTIAL *)credential;
return miCASAWriteBinaryKey(
// TODO: set shared if passed in
// set apps binary key
rcode = miCASAWriteBinaryKey(
context,
ssFlags,
&kc,
@ -2914,14 +2945,14 @@ miCASASetCredential
binaryCred->dataLen,
NULL,
ext);
miCASACloseSecretStoreCache(context, ssFlags, NULL);
return rcode;
}
else
basicCred = (SSCS_BASIC_CREDENTIAL *)credential;
// check params
if ((appSecretID == NULL) || (credential == NULL))
{
return(NSSCS_E_INVALID_PARAM);
}
// determine username key name, ie CN, LDAPDN, etc
if (basicCred->unFlags & USERNAME_TYPE_NDS_DN_F)