Surface miCASAReadKey for FireFox extension.
This commit is contained in:
parent
61ec97b695
commit
0b3db62210
@ -126,8 +126,14 @@ namespace sscs.verbs
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
secret = keyChain.GetSecret(secretId);
|
secret = keyChain.GetSecret(secretId);
|
||||||
string valStr = secret.GetKeyValue(key).GetValue();
|
KeyValue kv = secret.GetKeyValue(key);
|
||||||
val = Encoding.UTF8.GetBytes(valStr);
|
if (kv != null)
|
||||||
|
{
|
||||||
|
string valStr = secret.GetKeyValue(key).GetValue();
|
||||||
|
val = Encoding.UTF8.GetBytes(valStr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
retCode = IPCRetCodes.SSCS_E_SECRETID_DOES_NOT_EXIST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -536,6 +536,51 @@ static int32_t sscsshs_UnescapeSecretIDBuf
|
|||||||
/* ############################### CODE ENDS HERE ############################# */
|
/* ############################### CODE ENDS HERE ############################# */
|
||||||
} /* end of sscsshs_UnescapeSecretIDBuf */
|
} /* 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,
|
epPassword,
|
||||||
bytesRequired,
|
bytesRequired,
|
||||||
ext);
|
ext);
|
||||||
|
|
||||||
|
if (rc == NSSCS_SUCCESS)
|
||||||
|
{
|
||||||
|
unescapeString(val, valLen);
|
||||||
|
}
|
||||||
|
|
||||||
/* ############################### CODE EXITS HERE ############################# */
|
/* ############################### CODE EXITS HERE ############################# */
|
||||||
|
|
||||||
|
@ -478,6 +478,22 @@ miCASAWriteBinaryKey
|
|||||||
SSCS_EXT_T * ext
|
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)
|
SSCS_EXTERN_LIBCALL(int32_t)
|
||||||
miCASAReadBinaryKey
|
miCASAReadBinaryKey
|
||||||
(
|
(
|
||||||
|
@ -487,6 +487,21 @@ int sscs_CacheWriteBinaryKey
|
|||||||
void *reserved
|
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
|
int sscs_CacheReadBinaryKey
|
||||||
(
|
(
|
||||||
void *ssHandle,
|
void *ssHandle,
|
||||||
|
Loading…
Reference in New Issue
Block a user