add new func

Signed-off-by: 萌萌萌新 <yaoji2@huawei.com>
This commit is contained in:
萌萌萌新 2024-10-26 15:09:41 +08:00
parent 1b8d9b8721
commit d6b027d2fd
3 changed files with 17 additions and 31 deletions

View File

@ -92,34 +92,6 @@
],
"header_base": "//base/security/crypto_framework/interfaces/inner_api"
}
},
{
"name": "//base/security/crypto_framework/frameworks/cj:cj_cryptoframework_ffi",
"header": {
"header_files": [
"asy_key_generator_impl.h",
"asy_key_spec_generator_impl.h",
"cipher_impl.h",
"crypto_ffi.h",
"dh_key_util_impl.h",
"ecc_key_util_impl.h",
"kdf_impl.h",
"key_agreement_impl.h",
"key_impl.h",
"key_pair_impl.h",
"mac_impl.h",
"md_impl.h",
"pri_key_impl.h",
"pub_key_impl.h",
"random_impl.h",
"sign_impl.h",
"sm2_crypto_util_impl.h",
"sym_key_generator_impl.h",
"sym_key_impl.h",
"verify_impl.h"
],
"header_base": "//base/security/crypto_framework/frameworks/cj/include"
}
}
],
"test": [

View File

@ -152,7 +152,7 @@ extern "C" {
FFI_EXPORT int FFiOHOSPriKeyGetAsyKeySpecByNum(int64_t id, int32_t itemType, int32_t *errCode);
FFI_EXPORT char *FFiOHOSPriKeyGetAsyKeySpecByStr(int64_t id, int32_t itemType, int32_t *errCode);
FFI_EXPORT HcfBigInteger FFiOHOSPriKeyGetAsyKeySpecByBigInt(int64_t id, int32_t itemType, int32_t *errCode);
FFI_EXPORT const char *FfiOHOSPriKeyKeyGetFormat(int64_t id, int32_t* errCode);
FFI_EXPORT const char *FfiOHOSPriKeyGetFormat(int64_t id, int32_t* errCode);
// pubkey
FFI_EXPORT HcfBlob FFiOHOSPubKeyGetEncoded(int64_t id, int32_t *errCode);
@ -161,7 +161,8 @@ extern "C" {
FFI_EXPORT int FFiOHOSPubKeyGetAsyKeySpecByNum(int64_t id, int32_t itemType, int32_t *errCode);
FFI_EXPORT char *FFiOHOSPubKeyGetAsyKeySpecByStr(int64_t id, int32_t itemType, int32_t *errCode);
FFI_EXPORT HcfBigInteger FFiOHOSPubKeyGetAsyKeySpecByBigInt(int64_t id, int32_t itemType, int32_t *errCode);
FFI_EXPORT const char *FfiOHOSPubKeyKeyGetFormat(int64_t id, int32_t* errCode);
FFI_EXPORT const char *FfiOHOSPubKeyGetFormat(int64_t id, int32_t* errCode);
FFI_EXPORT void *FfiOHOSPubKeyGetRawPointer(int64_t id);
// keypair
FFI_EXPORT int64_t FFiOHOSKeyPairPubKey(int64_t id, int32_t *errCode);

View File

@ -308,7 +308,7 @@ namespace OHOS {
LOGE("[SymKey] instance not exist.");
return nullptr;
}
HcfKey *key = instance->GetHcfKey();
HcfKey *key = instance->GetHcfKey();
LOGD("[SymKey] GetHcfKey success");
return key;
}
@ -1621,6 +1621,19 @@ namespace OHOS {
return res;
}
void *FfiOHOSPubKeyGetRawPointer(int64_t id)
{
LOGD("[PubKey] FfiOHOSPubKeyGetRawPointer start");
auto instance = FFIData::GetData<PubKeyImpl>(id);
if (!instance) {
LOGE("[PubKey] instance not exist.");
return nullptr;
}
HcfPubKey *key = instance->GetPubKey();
LOGD("[PubKey] FfiOHOSPubKeyGetRawPointer success");
return key;
}
// ------------------------------------keypair
int64_t FFiOHOSKeyPairPubKey(int64_t id, int32_t *errCode)
{