API参考
载入中...
搜索中...
未找到
Crypt_eal_pkey

the asym key module 更多...

Crypt_eal_pkey 的协作图:

struct  RSA_PadingPara
struct  CRYPT_EAL_PkeyPub
struct  CRYPT_EAL_PkeyPrv
struct  CRYPT_EAL_PkeyPara

类型定义

typedef struct EAL_PkeyCtx CRYPT_EAL_PkeyCtx

函数

CRYPT_EAL_PkeyCtxCRYPT_EAL_MakeKeyByPkeyAlgInfo (CRYPT_EAL_PkeyMgmtInfo *pkeyAlgInfo, void *keyRef)
 Create a new asymmetric key context by key management information.
int32_t CRYPT_EAL_GetPkeyAlgInfo (CRYPT_EAL_LibCtx *libCtx, int32_t algId, const char *attrName, CRYPT_EAL_PkeyMgmtInfo *pkeyAlgInfo)
 Get the key management information by algorithm ID and attribute name.
bool CRYPT_EAL_PkeyIsValidAlgId (CRYPT_PKEY_AlgId id)
 Check whether the id is valid asymmetric algorithm ID.
CRYPT_EAL_PkeyCtxCRYPT_EAL_PkeyNewCtx (CRYPT_PKEY_AlgId id)
 Create an asymmetric key pair structure.
CRYPT_EAL_PkeyCtxCRYPT_EAL_ProviderPkeyNewCtx (CRYPT_EAL_LibCtx *libCtx, int32_t algId, uint32_t pkeyOperType, const char *attrName)
 Create an asymmetric key pair structure in the providers.
int32_t CRYPT_EAL_PkeyCopyCtx (CRYPT_EAL_PkeyCtx *to, const CRYPT_EAL_PkeyCtx *from)
 Copy the pkey context.
CRYPT_EAL_PkeyCtxCRYPT_EAL_PkeyDupCtx (const CRYPT_EAL_PkeyCtx *pkey)
 Dup the Pkey context. After the duplication is complete, call the CRYPT_EAL_PkeyFreeCtx interface to release the memory.
void CRYPT_EAL_PkeyFreeCtx (CRYPT_EAL_PkeyCtx *pkey)
 Release the asymmetric key pair structure.
int32_t CRYPT_EAL_PkeySetPara (CRYPT_EAL_PkeyCtx *pkey, const CRYPT_EAL_PkeyPara *para)
 Set the key parameters, the key parameter marked as "para" is applied for and released by the caller.
int32_t CRYPT_EAL_PkeySetParaEx (CRYPT_EAL_PkeyCtx *pkey, const BSL_Param *param)
 Set the key parameters.
int32_t CRYPT_EAL_PkeyGetPara (const CRYPT_EAL_PkeyCtx *pkey, CRYPT_EAL_PkeyPara *para)
 Obtain the key parameter, the key parameter marked as "para" is applied for and released by the caller.
int32_t CRYPT_EAL_PkeySetParaById (CRYPT_EAL_PkeyCtx *pkey, CRYPT_PKEY_ParaId id)
 Set key parameters.
int32_t CRYPT_EAL_PkeyGen (CRYPT_EAL_PkeyCtx *pkey)
 Generate the key data.
int32_t CRYPT_EAL_PkeySetPub (CRYPT_EAL_PkeyCtx *pkey, const CRYPT_EAL_PkeyPub *key)
 Set the public key. The caller applies for and releases memory for the public key marked as "key".
int32_t CRYPT_EAL_PkeySetPubEx (CRYPT_EAL_PkeyCtx *pkey, const BSL_Param *param)
 Extended interface to set the public key.
int32_t CRYPT_EAL_PkeySetPrv (CRYPT_EAL_PkeyCtx *pkey, const CRYPT_EAL_PkeyPrv *key)
 Set the private key. The caller applies for and releases memory for the private key marked as "key".
int32_t CRYPT_EAL_PkeySetPrvEx (CRYPT_EAL_PkeyCtx *pkey, const BSL_Param *param)
 Extended interface to set the private key.
int32_t CRYPT_EAL_PkeyGetPub (const CRYPT_EAL_PkeyCtx *pkey, CRYPT_EAL_PkeyPub *key)
 Obtain the public key. The caller applies for and releases memory for the public key marked as "key".
int32_t CRYPT_EAL_PkeyGetPubEx (const CRYPT_EAL_PkeyCtx *pkey, BSL_Param *param)
 Extended interface to obtain the public key.
int32_t CRYPT_EAL_PkeyGetPrv (const CRYPT_EAL_PkeyCtx *pkey, CRYPT_EAL_PkeyPrv *key)
 Obtain the private key. The caller applies for and releases memory for the private key marked as "key".
int32_t CRYPT_EAL_PkeyGetPrvEx (const CRYPT_EAL_PkeyCtx *pkey, BSL_Param *param)
 Extended interface to obtain the private key.
int32_t CRYPT_EAL_PkeySign (const CRYPT_EAL_PkeyCtx *pkey, CRYPT_MD_AlgId id, const uint8_t *data, uint32_t dataLen, uint8_t *sign, uint32_t *signLen)
 Signature interface
int32_t CRYPT_EAL_PkeyVerify (const CRYPT_EAL_PkeyCtx *pkey, CRYPT_MD_AlgId id, const uint8_t *data, uint32_t dataLen, const uint8_t *sign, uint32_t signLen)
 Signature verification interface
int32_t CRYPT_EAL_PkeySignData (const CRYPT_EAL_PkeyCtx *pkey, const uint8_t *hash, uint32_t hashLen, uint8_t *sign, uint32_t *signLen)
 Sign hash data(RSA9796-2 Signature is not supported)
int32_t CRYPT_EAL_PkeyVerifyData (const CRYPT_EAL_PkeyCtx *pkey, const uint8_t *hash, uint32_t hashLen, const uint8_t *sign, uint32_t signLen)
 Verify the signature of the hash data(RSA9796-2 Signature is not supported)
int32_t CRYPT_EAL_PkeyEncrypt (const CRYPT_EAL_PkeyCtx *pkey, const uint8_t *data, uint32_t dataLen, uint8_t *out, uint32_t *outLen)
 Encrypt data.
int32_t CRYPT_EAL_PkeyDecrypt (const CRYPT_EAL_PkeyCtx *pkey, const uint8_t *data, uint32_t dataLen, uint8_t *out, uint32_t *outLen)
 Decrypt the data.
int32_t CRYPT_EAL_PkeyHEAdd (const CRYPT_EAL_PkeyCtx *pkey, const BSL_Param *input, uint8_t *out, uint32_t *outLen)
 Homomorphic addition operations
int32_t CRYPT_EAL_PkeyHEMul (const CRYPT_EAL_PkeyCtx *pkey, const BSL_Param *input, uint8_t *out, uint32_t *outLen)
 Homomorphic multiplication operations
int32_t CRYPT_EAL_PkeyPairCheck (CRYPT_EAL_PkeyCtx *pubKey, CRYPT_EAL_PkeyCtx *prvKey)
 Check whether the public and private keys match.
int32_t CRYPT_EAL_PkeyPrvCheck (CRYPT_EAL_PkeyCtx *prvKey)
 Check the private key is valid.
int32_t CRYPT_EAL_PkeyComputeShareKey (const CRYPT_EAL_PkeyCtx *pkey, const CRYPT_EAL_PkeyCtx *pubKey, uint8_t *share, uint32_t *shareLen)
 Compute the shared key.
uint32_t CRYPT_EAL_PkeyGetKeyLen (const CRYPT_EAL_PkeyCtx *pkey)
 Obtain the number of bytes in the key length.
uint32_t CRYPT_EAL_PkeyGetSecurityBits (const CRYPT_EAL_PkeyCtx *pkey)
 Obtain the key security strength. Only supports CRYPT_PKEY_RSA and CRYPT_PKEY_ECDSA.
uint32_t CRYPT_EAL_PkeyGetKeyBits (const CRYPT_EAL_PkeyCtx *pkey)
 Obtain the number of bits in the key length.
uint32_t CRYPT_EAL_PkeyGetSignLen (const CRYPT_EAL_PkeyCtx *pkey)
 Obtains the signature length of the key for signature, only support algorithm that can be signed.
int32_t CRYPT_EAL_PkeyCtrl (CRYPT_EAL_PkeyCtx *pkey, int32_t opt, void *val, uint32_t len)
 Make specific option for setting/obtain, supported option can see the structure of CRYPT_PkeyCtrl.
int32_t CRYPT_EAL_PkeyBlind (CRYPT_EAL_PkeyCtx *pkey, CRYPT_MD_AlgId id, const uint8_t *input, uint32_t inputLen, uint8_t *out, uint32_t *outLen)
 Perform blind operation on input data using the specified algorithm. For RSA BSSA, users need to ensure sufficient entropy in the message if the input has low entropy.
int32_t CRYPT_EAL_PkeyUnBlind (CRYPT_EAL_PkeyCtx *pkey, const uint8_t *input, uint32_t inputLen, uint8_t *out, uint32_t *outLen)
 Perform unblind operation on blinded data.
CRYPT_PKEY_AlgId CRYPT_EAL_PkeyGetId (const CRYPT_EAL_PkeyCtx *pkey)
 Obtain the key algorithm type.
CRYPT_PKEY_ParaId CRYPT_EAL_PkeyGetParaId (const CRYPT_EAL_PkeyCtx *pkey)
 Obtain the key algorithm parameter ID.
int32_t CRYPT_EAL_PkeyCmp (const CRYPT_EAL_PkeyCtx *a, const CRYPT_EAL_PkeyCtx *b)
 Compare keys or parameters
int32_t CRYPT_EAL_PkeySetExtData (CRYPT_EAL_PkeyCtx *pkey, void *data)
 Set the user's personal data.
void * CRYPT_EAL_PkeyGetExtData (const CRYPT_EAL_PkeyCtx *pkey)
 Obtain the user's personal data.
int32_t CRYPT_EAL_PkeyUpRef (CRYPT_EAL_PkeyCtx *pkey)
 EAL layer reference counting auto-increment
int32_t CRYPT_EAL_PkeyEncapsInit (CRYPT_EAL_PkeyCtx *pkey, const BSL_Param *params)
 Initialize asymmetric key encapsulation context
int32_t CRYPT_EAL_PkeyDecapsInit (CRYPT_EAL_PkeyCtx *pkey, const BSL_Param *params)
 Initialize asymmetric key decapsulation context
int32_t CRYPT_EAL_PkeyEncaps (const CRYPT_EAL_PkeyCtx *pkey, uint8_t *cipher, uint32_t *cipherLen, uint8_t *sharekey, uint32_t *shareKeyLen)
 Perform key encapsulation operation
int32_t CRYPT_EAL_PkeyDecaps (const CRYPT_EAL_PkeyCtx *pkey, const uint8_t *cipher, uint32_t cipherLen, uint8_t *sharekey, uint32_t *shareKeyLen)
 Perform key decapsulation operation

详细描述

the asym key module

类型定义说明

◆ CRYPT_EAL_PkeyCtx

typedef struct EAL_PkeyCtx CRYPT_EAL_PkeyCtx

Pkey session structure.

函数说明

◆ CRYPT_EAL_GetPkeyAlgInfo()

int32_t CRYPT_EAL_GetPkeyAlgInfo ( CRYPT_EAL_LibCtx * libCtx,
int32_t algId,
const char * attrName,
CRYPT_EAL_PkeyMgmtInfo * pkeyAlgInfo )

Get the key management information by algorithm ID and attribute name.

参数
libCtx[IN] The library context.
algId[IN] The algorithm ID.
attrName[IN] The attribute name.
pkeyAlgInfo[OUT] The key management information.

◆ CRYPT_EAL_MakeKeyByPkeyAlgInfo()

CRYPT_EAL_PkeyCtx * CRYPT_EAL_MakeKeyByPkeyAlgInfo ( CRYPT_EAL_PkeyMgmtInfo * pkeyAlgInfo,
void * keyRef )

Create a new asymmetric key context by key management information.

参数
pkeyAlgInfo[IN] The key management information.
keyRef[IN] The reference to the key.
返回
pkey on success, NULL on failure.

◆ CRYPT_EAL_PkeyBlind()

int32_t CRYPT_EAL_PkeyBlind ( CRYPT_EAL_PkeyCtx * pkey,
CRYPT_MD_AlgId id,
const uint8_t * input,
uint32_t inputLen,
uint8_t * out,
uint32_t * outLen )

Perform blind operation on input data using the specified algorithm. For RSA BSSA, users need to ensure sufficient entropy in the message if the input has low entropy.

参数
pkey[IN] Key session
id[IN] md Id for input.
input[IN] Data to be blinded
inputLen[IN] Length of input data
out[OUT] Blinded output data
outLen[OUT] Length of blinded data
返回值
CRYPT_SUCCESS,ifsuccessful. For other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyCmp()

int32_t CRYPT_EAL_PkeyCmp ( const CRYPT_EAL_PkeyCtx * a,
const CRYPT_EAL_PkeyCtx * b )

Compare keys or parameters

参数
a[IN] Key session
b[IN] Key session
返回值
CRYPT_SUCCESS,aand b are the same(include both a and b are null)
CRYPT_NULL_INPUT,incorrectnull pointer input.
Forother error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyComputeShareKey()

int32_t CRYPT_EAL_PkeyComputeShareKey ( const CRYPT_EAL_PkeyCtx * pkey,
const CRYPT_EAL_PkeyCtx * pubKey,
uint8_t * share,
uint32_t * shareLen )

Compute the shared key.

参数
pkey[IN] Key session
pubKey[IN] Public key session
share[OUT] Shared key
shareLen[IN/OUT] The input parameter is the share space length, and the output parameter is the valid share space length, the required space can be obtained by calling the CRYPT_EAL_PkeyGetKeyLen interface.
返回值
CRYPT_SUCCESS,ifsuccessful. For other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyCopyCtx()

int32_t CRYPT_EAL_PkeyCopyCtx ( CRYPT_EAL_PkeyCtx * to,
const CRYPT_EAL_PkeyCtx * from )

Copy the pkey context.

注解
to and from must has identical key management.
参数
to[IN/OUT] Target pkey context
from[IN] Source pkey context
返回值
CRYPT_SUCCESSFor other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyCtrl()

int32_t CRYPT_EAL_PkeyCtrl ( CRYPT_EAL_PkeyCtx * pkey,
int32_t opt,
void * val,
uint32_t len )

Make specific option for setting/obtain, supported option can see the structure of CRYPT_PkeyCtrl.

参数
pkey[IN] Key session
opt[IN] Option information
val[IN/OUT] Data to be set/obtained
len[IN] Length of the data marked as "val"
返回值
CRYPT_SUCCESS,ifsuccessful. For other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyDecaps()

int32_t CRYPT_EAL_PkeyDecaps ( const CRYPT_EAL_PkeyCtx * pkey,
const uint8_t * cipher,
uint32_t cipherLen,
uint8_t * sharekey,
uint32_t * shareKeyLen )

Perform key decapsulation operation

参数
pkey[in] Initialized key context
cipher[in] Input encapsulated ciphertext
cipherLen[in] Length of the input ciphertext
sharekey[out] Output buffer for shared secret
shareKeyLen[in,out] Input: buffer capacity, Output: actual secret length
返回值
CRYPT_SUCCESSFor other error codes see crypt_errno.h.

◆ CRYPT_EAL_PkeyDecapsInit()

int32_t CRYPT_EAL_PkeyDecapsInit ( CRYPT_EAL_PkeyCtx * pkey,
const BSL_Param * params )

Initialize asymmetric key decapsulation context

参数
pkey[in] Pointer to the key context
params[in] Algorithm parameters
返回值
CRYPT_SUCCESSFor other error codes see crypt_errno.h.

◆ CRYPT_EAL_PkeyDecrypt()

int32_t CRYPT_EAL_PkeyDecrypt ( const CRYPT_EAL_PkeyCtx * pkey,
const uint8_t * data,
uint32_t dataLen,
uint8_t * out,
uint32_t * outLen )

Decrypt the data.

参数
pkey[IN] Key session
data[IN] Input ciphertext data.
dataLen[IN] Input ciphertext data length.
out[OUT] Decrypted data
outLen[OUT/IN] Length of the decrypted data.
返回值
CRYPT_SUCCESS,ifsuccessful. For other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyDupCtx()

CRYPT_EAL_PkeyCtx * CRYPT_EAL_PkeyDupCtx ( const CRYPT_EAL_PkeyCtx * pkey)

Dup the Pkey context. After the duplication is complete, call the CRYPT_EAL_PkeyFreeCtx interface to release the memory.

参数
pkey[IN] Source Pkey context
返回值
CRYPT_EAL_PkeyCtx,Pkeycontext pointer. NULL, if the operation fails.

◆ CRYPT_EAL_PkeyEncaps()

int32_t CRYPT_EAL_PkeyEncaps ( const CRYPT_EAL_PkeyCtx * pkey,
uint8_t * cipher,
uint32_t * cipherLen,
uint8_t * sharekey,
uint32_t * shareKeyLen )

Perform key encapsulation operation

参数
pkey[in] Initialized key context
cipher[out] Output buffer for encapsulated ciphertext
cipherLen[in,out] Input: buffer capacity, Output: actual ciphertext length
sharekey[out] Output buffer for shared secret
shareKeyLen[in,out] Input: buffer capacity, Output: actual secret length
返回值
CRYPT_SUCCESSFor other error codes see crypt_errno.h.

◆ CRYPT_EAL_PkeyEncapsInit()

int32_t CRYPT_EAL_PkeyEncapsInit ( CRYPT_EAL_PkeyCtx * pkey,
const BSL_Param * params )

Initialize asymmetric key encapsulation context

参数
pkey[in] Pointer to the key context
params[in] Algorithm parameters
返回值
CRYPT_SUCCESSFor other error codes see crypt_errno.h.

◆ CRYPT_EAL_PkeyEncrypt()

int32_t CRYPT_EAL_PkeyEncrypt ( const CRYPT_EAL_PkeyCtx * pkey,
const uint8_t * data,
uint32_t dataLen,
uint8_t * out,
uint32_t * outLen )

Encrypt data.

参数
pkey[IN] Key session
data[IN] Input plaintext data.
dataLen[IN] Input plaintext data length.
out[OUT] Encrypted data. The buff length of the memory used to store the encrypted data must be greater than or equal to the key modulus length.
outLen[OUT/IN] Encrypted data length.
返回值
CRYPT_SUCCESS,ifsuccessful. For other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyFreeCtx()

void CRYPT_EAL_PkeyFreeCtx ( CRYPT_EAL_PkeyCtx * pkey)

Release the asymmetric key pair structure.

参数
pkey[IN] Pkey context, which need to be set NULL by the caller.

◆ CRYPT_EAL_PkeyGen()

int32_t CRYPT_EAL_PkeyGen ( CRYPT_EAL_PkeyCtx * pkey)

Generate the key data.

参数
pkey[IN/OUT] Key pair structure for receiving key data.
返回值
CRYPT_SUCCESSFor other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyGetExtData()

void * CRYPT_EAL_PkeyGetExtData ( const CRYPT_EAL_PkeyCtx * pkey)

Obtain the user's personal data.

参数
pkey[IN] Key session
返回值
void*(userpersonal data pointer), which indicates successful. NULL, which indicates failed.

◆ CRYPT_EAL_PkeyGetId()

CRYPT_PKEY_AlgId CRYPT_EAL_PkeyGetId ( const CRYPT_EAL_PkeyCtx * pkey)

Obtain the key algorithm type.

参数
pkey[IN] Key session
返回值
Keyalgorithm type

◆ CRYPT_EAL_PkeyGetKeyBits()

uint32_t CRYPT_EAL_PkeyGetKeyBits ( const CRYPT_EAL_PkeyCtx * pkey)

Obtain the number of bits in the key length.

参数
pkey[IN] Key session
返回值
Numberof key bits, if successful. 0, if failed.

◆ CRYPT_EAL_PkeyGetKeyLen()

uint32_t CRYPT_EAL_PkeyGetKeyLen ( const CRYPT_EAL_PkeyCtx * pkey)

Obtain the number of bytes in the key length.

参数
pkey[IN] Key session
返回值
Keylength, if successful. 0, if failed.

◆ CRYPT_EAL_PkeyGetPara()

int32_t CRYPT_EAL_PkeyGetPara ( const CRYPT_EAL_PkeyCtx * pkey,
CRYPT_EAL_PkeyPara * para )

Obtain the key parameter, the key parameter marked as "para" is applied for and released by the caller.

参数
pkey[IN] Key pair structure
para[OUT] Parameter to be received
返回值
CRYPT_SUCCESSFor other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyGetParaId()

CRYPT_PKEY_ParaId CRYPT_EAL_PkeyGetParaId ( const CRYPT_EAL_PkeyCtx * pkey)

Obtain the key algorithm parameter ID.

参数
pkey[IN] Key session
返回值
Algorithmparameter ID

◆ CRYPT_EAL_PkeyGetPrv()

int32_t CRYPT_EAL_PkeyGetPrv ( const CRYPT_EAL_PkeyCtx * pkey,
CRYPT_EAL_PkeyPrv * key )

Obtain the private key. The caller applies for and releases memory for the private key marked as "key".

参数
pkey[IN] Key session
key[OUT] Private key data
返回值
CRYPT_SUCCESSFor other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyGetPrvEx()

int32_t CRYPT_EAL_PkeyGetPrvEx ( const CRYPT_EAL_PkeyCtx * pkey,
BSL_Param * param )

Extended interface to obtain the private key.

This function is an extended version of CRYPT_EAL_PkeyGetPrv, which allows passing parameters through the BSL_Param structure to meet more complex public key acquisition requirements.

参数
pkey[IN] Key session
param[OUT] Private key data
返回值
CRYPT_SUCCESSFor other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyGetPub()

int32_t CRYPT_EAL_PkeyGetPub ( const CRYPT_EAL_PkeyCtx * pkey,
CRYPT_EAL_PkeyPub * key )

Obtain the public key. The caller applies for and releases memory for the public key marked as "key".

参数
pkey[IN] Key session
key[OUT] Public key data
返回值
CRYPT_SUCCESSFor other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyGetPubEx()

int32_t CRYPT_EAL_PkeyGetPubEx ( const CRYPT_EAL_PkeyCtx * pkey,
BSL_Param * param )

Extended interface to obtain the public key.

This function is an extended version of CRYPT_EAL_PkeyGetPub, which allows passing parameters through the BSL_Param structure to meet more complex public key acquisition requirements.

参数
pkey[IN] Key session
param[IN] parameters
返回值
CRYPT_SUCCESSFor other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyGetSecurityBits()

uint32_t CRYPT_EAL_PkeyGetSecurityBits ( const CRYPT_EAL_PkeyCtx * pkey)

Obtain the key security strength. Only supports CRYPT_PKEY_RSA and CRYPT_PKEY_ECDSA.

参数
pkey[IN] Key session
返回值
Keysecurity strength, if successful. 0, if failed.

◆ CRYPT_EAL_PkeyGetSignLen()

uint32_t CRYPT_EAL_PkeyGetSignLen ( const CRYPT_EAL_PkeyCtx * pkey)

Obtains the signature length of the key for signature, only support algorithm that can be signed.

参数
pkey[IN] Key session
返回值
Signaturelength, if successful. 0, if failed.

◆ CRYPT_EAL_PkeyHEAdd()

int32_t CRYPT_EAL_PkeyHEAdd ( const CRYPT_EAL_PkeyCtx * pkey,
const BSL_Param * input,
uint8_t * out,
uint32_t * outLen )

Homomorphic addition operations

参数
pkey[IN] Addition Context
input[IN] Input ciphertext data
out[OUT] The result of the addition operation
outLen[OUT/IN] Pointer to the length of the addition result
返回值
CRYPT_SUCCESS,ifsuccessful. For other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyHEMul()

int32_t CRYPT_EAL_PkeyHEMul ( const CRYPT_EAL_PkeyCtx * pkey,
const BSL_Param * input,
uint8_t * out,
uint32_t * outLen )

Homomorphic multiplication operations

参数
pkey[IN] Multiplication Context
input[IN] Input ciphertext data
out[OUT] The result of the multiplication operation
outLen[OUT/IN] Pointer to the length of the multiplication result
返回值
CRYPT_SUCCESS,ifsuccessful. For other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyIsValidAlgId()

bool CRYPT_EAL_PkeyIsValidAlgId ( CRYPT_PKEY_AlgId id)

Check whether the id is valid asymmetric algorithm ID.

参数
id[IN] Asymmetric algorithm ID
返回值
true,ifthe value is valid. false, if the value is invalid.

◆ CRYPT_EAL_PkeyNewCtx()

CRYPT_EAL_PkeyCtx * CRYPT_EAL_PkeyNewCtx ( CRYPT_PKEY_AlgId id)

Create an asymmetric key pair structure.

参数
id[IN] Algorithm ID
返回值
CRYPT_EAL_PkeyCtxpointer. NULL, if the operation fails.

◆ CRYPT_EAL_PkeyPairCheck()

int32_t CRYPT_EAL_PkeyPairCheck ( CRYPT_EAL_PkeyCtx * pubKey,
CRYPT_EAL_PkeyCtx * prvKey )

Check whether the public and private keys match.

注解
pubKey and prvKey must has identical key management.
参数
pubKey[IN] Public key
prvKey[IN] private key
返回值
CRYPT_SUCCESS,ifsuccessful. For other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyPrvCheck()

int32_t CRYPT_EAL_PkeyPrvCheck ( CRYPT_EAL_PkeyCtx * prvKey)

Check the private key is valid.

参数
prvKey[IN] Private key
返回值
CRYPT_SUCCESS,ifsuccessful. For other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeySetExtData()

int32_t CRYPT_EAL_PkeySetExtData ( CRYPT_EAL_PkeyCtx * pkey,
void * data )

Set the user's personal data.

参数
pkey[IN] Key session
data[IN] Pointer to the user's personal data
返回值
CRYPT_SUCCESS,ifsuccessful.
CRYPT_NULL_INPUT,ifpkey is NULL.

◆ CRYPT_EAL_PkeySetPara()

int32_t CRYPT_EAL_PkeySetPara ( CRYPT_EAL_PkeyCtx * pkey,
const CRYPT_EAL_PkeyPara * para )

Set the key parameters, the key parameter marked as "para" is applied for and released by the caller.

参数
pkey[IN/OUT] Structure of the key pair to be set
para[IN] Parameter
返回值
CRYPT_SUCCESSFor other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeySetParaById()

int32_t CRYPT_EAL_PkeySetParaById ( CRYPT_EAL_PkeyCtx * pkey,
CRYPT_PKEY_ParaId id )

Set key parameters.

参数
pkey[IN/OUT] Structure of the key pair to be set.
id[IN] Parameter ID.
返回值
CRYPT_SUCCESSFor other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeySetParaEx()

int32_t CRYPT_EAL_PkeySetParaEx ( CRYPT_EAL_PkeyCtx * pkey,
const BSL_Param * param )

Set the key parameters.

参数
pkey[IN/OUT] Structure of the key pair to be set
param[IN] Parameter
返回值
CRYPT_SUCCESSFor other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeySetPrv()

int32_t CRYPT_EAL_PkeySetPrv ( CRYPT_EAL_PkeyCtx * pkey,
const CRYPT_EAL_PkeyPrv * key )

Set the private key. The caller applies for and releases memory for the private key marked as "key".

参数
pkey[OUT] Key pair structure for receiving key data
key[IN] Private key data
返回值
CRYPT_SUCCESSFor other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeySetPrvEx()

int32_t CRYPT_EAL_PkeySetPrvEx ( CRYPT_EAL_PkeyCtx * pkey,
const BSL_Param * param )

Extended interface to set the private key.

This function is an extended version of CRYPT_EAL_PkeySetPrv, which allows passing additional parameters to meet more complex public key setting requirements.

参数
pkey[OUT] Key pair structure for receiving key data
param[IN] Private key data
返回值
CRYPT_SUCCESSFor other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeySetPub()

int32_t CRYPT_EAL_PkeySetPub ( CRYPT_EAL_PkeyCtx * pkey,
const CRYPT_EAL_PkeyPub * key )

Set the public key. The caller applies for and releases memory for the public key marked as "key".

参数
pkey[OUT] Key pair structure for receiving key data
key[IN] Public key data
返回值
CRYPT_SUCCESSFor other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeySetPubEx()

int32_t CRYPT_EAL_PkeySetPubEx ( CRYPT_EAL_PkeyCtx * pkey,
const BSL_Param * param )

Extended interface to set the public key.

This function is an extended version of CRYPT_EAL_PkeySetPub, which allows passing additional parameters to meet more complex public key setting requirements.

参数
pkey[OUT] Key pair structure for receiving key data
param[IN] Public key data
返回值
CRYPT_SUCCESSFor other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeySign()

int32_t CRYPT_EAL_PkeySign ( const CRYPT_EAL_PkeyCtx * pkey,
CRYPT_MD_AlgId id,
const uint8_t * data,
uint32_t dataLen,
uint8_t * sign,
uint32_t * signLen )

Signature interface

参数
pkey[IN] Key session
id[IN] Hash algorithm ID.
data[IN] Plaintext data
dataLen[IN] Plaintext length. The maximum length is [0, 0xffffffff].
sign[OUT] Signature data. The length of the memory buff used to save the signature must be greater than or equal to the key modulo length.
signLen[OUT/IN] Length of the signature data, You can obtain the value by calling CRYPT_EAL_PkeyGetSignLen.
返回值
CRYPT_SUCCESSFor other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeySignData()

int32_t CRYPT_EAL_PkeySignData ( const CRYPT_EAL_PkeyCtx * pkey,
const uint8_t * hash,
uint32_t hashLen,
uint8_t * sign,
uint32_t * signLen )

Sign hash data(RSA9796-2 Signature is not supported)

参数
pkey[IN] Key session
hash[IN] Hash data
hashLen[IN] Hash length. When RSA is used for signature, the hash length should correspond to the digest length of the hash algorithm on which the padding method depends.
sign[OUT] Signature data. The length of the memory buff used to save the signature must be greater than or equal to the key module length.
signLen[OUT/IN] Length of the signature data. The value can be obtained by calling CRYPT_EAL_PkeyGetSignLen.
返回值
CRYPT_SUCCESS,ifsuccessful. For other error codes see crypt_errno.h

◆ CRYPT_EAL_PkeyUnBlind()

int32_t CRYPT_EAL_PkeyUnBlind ( CRYPT_EAL_PkeyCtx * pkey,
const uint8_t * input,
uint32_t inputLen,
uint8_t * out,
uint32_t * outLen )

Perform unblind operation on blinded data.

参数
pkey[IN] Key session
input[IN] Blinded data to be unblinded
inputLen[IN] Length of blinded data
out[OUT] Unblinded output data
outLen[OUT] Length of unblinded data
返回值
CRYPT_SUCCESS,ifsuccessful. For other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyUpRef()

int32_t CRYPT_EAL_PkeyUpRef ( CRYPT_EAL_PkeyCtx * pkey)

EAL layer reference counting auto-increment

参数
pkey[IN] Key session
返回值
CRYPT_SUCCESSFor other error codes see crypt_errno.h.

◆ CRYPT_EAL_PkeyVerify()

int32_t CRYPT_EAL_PkeyVerify ( const CRYPT_EAL_PkeyCtx * pkey,
CRYPT_MD_AlgId id,
const uint8_t * data,
uint32_t dataLen,
const uint8_t * sign,
uint32_t signLen )

Signature verification interface

参数
pkey[IN] Key session
id[IN] Hash algorithm ID.
data[IN] Plaintext data
dataLen[IN] Plaintext length. The maximum length is [0,0xffffffff].
sign[IN] Signature data
signLen[IN] Length of the signature data
返回值
CRYPT_SUCCESSFor other error codes, see crypt_errno.h.

◆ CRYPT_EAL_PkeyVerifyData()

int32_t CRYPT_EAL_PkeyVerifyData ( const CRYPT_EAL_PkeyCtx * pkey,
const uint8_t * hash,
uint32_t hashLen,
const uint8_t * sign,
uint32_t signLen )

Verify the signature of the hash data(RSA9796-2 Signature is not supported)

参数
pkey[IN] Key session
hash[IN] Hash data
hashLen[IN] Hash length. When RSA is used for signature, the hash length should correspond to the digest length of the hash algorithm on which the padding method depends.
sign[IN] Signature data
signLen[IN] Length of the signature data
返回值
CRYPT_SUCCESS,ifsuccessful. For other error codes, see crypt_errno.h.

◆ CRYPT_EAL_ProviderPkeyNewCtx()

CRYPT_EAL_PkeyCtx * CRYPT_EAL_ProviderPkeyNewCtx ( CRYPT_EAL_LibCtx * libCtx,
int32_t algId,
uint32_t pkeyOperType,
const char * attrName )

Create an asymmetric key pair structure in the providers.

参数
libCtx[IN] Library context
algId[IN] Asymmetric algorithm ID.
pkeyOperType[IN] Specify operation type.
attrName[IN] Specify expected attribute values
返回值
CRYPT_EAL_PkeyCtxpointer. NULL, if the operation fails.