Surface miCASAReadKey for FireFox extension.

This commit is contained in:
Jim Norman 2006-03-28 16:58:09 +00:00
parent 61ec97b695
commit 0b3db62210
4 changed files with 89 additions and 2 deletions

View File

@ -126,8 +126,14 @@ namespace sscs.verbs
else
{
secret = keyChain.GetSecret(secretId);
string valStr = secret.GetKeyValue(key).GetValue();
val = Encoding.UTF8.GetBytes(valStr);
KeyValue kv = secret.GetKeyValue(key);
if (kv != null)
{
string valStr = secret.GetKeyValue(key).GetValue();
val = Encoding.UTF8.GetBytes(valStr);
}
else
retCode = IPCRetCodes.SSCS_E_SECRETID_DOES_NOT_EXIST;
}
}
else

View File

@ -536,6 +536,51 @@ static int32_t sscsshs_UnescapeSecretIDBuf
/* ############################### CODE ENDS HERE ############################# */
} /* end of sscsshs_UnescapeSecretIDBuf */
static int32_t unescapeString(uint8_t *val, uint32_t *valueLen)
{
uint32_t k,i = 0;
uint32_t len = 0;
uint8_t *temp;
uint32_t rc = NSSCS_SUCCESS;
len = *valueLen;
temp = malloc(len);
if (temp)
{
for(k = i = 0; i < len; i++)
{
rc = NSSCS_SUCCESS;
if(val[i] == (SS_UTF8_T)'\\')
{
if(i + 1 < len)
{
if(val[i + 1] == (SS_UTF8_T)'\\'
|| val[i + 1] == (SS_UTF8_T)'='
|| val[i + 1] == (SS_UTF8_T)':')
{
temp[k++] = val[i + 1];
i++;
}
}
else
{
temp[k] = val[i];
}
}
else
{
temp[k++] = val[i];
}
} // end for ...
temp[k] = '\0';
sscs_Utf8Strcpy(val, temp);
*valueLen = k;
free(temp);
return rc;
}
else
return NSSCS_E_PARSER_FAILURE;
}
/*
@ -1798,6 +1843,11 @@ miCASAReadKey
epPassword,
bytesRequired,
ext);
if (rc == NSSCS_SUCCESS)
{
unescapeString(val, valLen);
}
/* ############################### CODE EXITS HERE ############################# */

View File

@ -478,6 +478,22 @@ miCASAWriteBinaryKey
SSCS_EXT_T * ext
);
SSCS_EXTERN_LIBCALL(int32_t)
miCASAReadKey
(
void * context,
uint32_t ssFlags,
SSCS_KEYCHAIN_ID_T * keyChainID,
SSCS_SECRET_ID_T * sharedSecretID,
SS_UTF8_T * key,
uint32_t keyLen,
uint8_t * val,
uint32_t * valLen,
SSCS_PASSWORD_T * epPassword,
uint32_t * bytesRequired,
SSCS_EXT_T * ext
);
SSCS_EXTERN_LIBCALL(int32_t)
miCASAReadBinaryKey
(

View File

@ -487,6 +487,21 @@ int sscs_CacheWriteBinaryKey
void *reserved
);
int sscs_CacheReadKey
(
void *ssHandle,
uint32_t ssFlags,
SSCS_KEYCHAIN_ID_T *keychainID,
SSCS_SECRET_ID_T *secretID,
SS_UTF8_T *key,
uint32_t keyLen,
uint8_t *val,
uint32_t *valLen,
SSCS_PASSWORD_T *epPassword,
uint32_t *bytesRequired,
void *reserved
);
int sscs_CacheReadBinaryKey
(
void *ssHandle,