22#ifndef CRYPT_EAL_PKEY_H
23#define CRYPT_EAL_PKEY_H
27#include "crypt_algid.h"
28#include "crypt_types.h"
29#include "bsl_params.h"
57#define CRYPT_EAL_PKEY_UNKNOWN_OPERATE 0
58#define CRYPT_EAL_PKEY_CIPHER_OPERATE 1
59#define CRYPT_EAL_PKEY_EXCH_OPERATE 2
60#define CRYPT_EAL_PKEY_SIGN_OPERATE 4
61#define CRYPT_EAL_PKEY_KEM_OPERATE 8
147 const char *attrName);
366 uint32_t dataLen, uint8_t *sign, uint32_t *signLen);
383 uint32_t dataLen,
const uint8_t *sign, uint32_t signLen);
403 uint8_t *sign, uint32_t *signLen);
421 const uint8_t *sign, uint32_t signLen);
438 uint8_t *out, uint32_t *outLen);
454 uint8_t *out, uint32_t *outLen);
522 uint8_t *share, uint32_t *shareLen);
597 uint8_t *out, uint32_t *outLen);
613 uint8_t *out, uint32_t *outLen);
721 uint32_t *shareKeyLen);
737 const CRYPT_EAL_PkeyCtx *pkey,
const uint8_t *cipher, uint32_t cipherLen, uint8_t *sharekey, uint32_t *shareKeyLen);
CRYPT_PKEY_ParaId
定义 crypt_algid.h:208
CRYPT_MD_AlgId
定义 crypt_algid.h:68
CRYPT_PKEY_AlgId
定义 crypt_algid.h:121
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 calle...
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_PkeyGen(CRYPT_EAL_PkeyCtx *pkey)
Generate the key 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_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_PkeyPrvCheck(CRYPT_EAL_PkeyCtx *prvKey)
Check the private key is valid.
void * CRYPT_EAL_PkeyGetExtData(const CRYPT_EAL_PkeyCtx *pkey)
Obtain the user's personal data.
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_PkeyComputeShareKey(const CRYPT_EAL_PkeyCtx *pkey, const CRYPT_EAL_PkeyCtx *pubKey, uint8_t *share, uint32_t *shareLen)
Compute the shared 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_PkeyDecaps(const CRYPT_EAL_PkeyCtx *pkey, const uint8_t *cipher, uint32_t cipherLen, uint8_t *sharekey, uint32_t *shareKeyLen)
Perform key decapsulation operation
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 ...
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,...
uint32_t CRYPT_EAL_PkeyGetKeyBits(const CRYPT_EAL_PkeyCtx *pkey)
Obtain the number of bits in the key length.
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_PkeyEncapsInit(CRYPT_EAL_PkeyCtx *pkey, const BSL_Param *params)
Initialize asymmetric key encapsulation context
int32_t CRYPT_EAL_PkeyGetPubEx(const CRYPT_EAL_PkeyCtx *pkey, BSL_Param *param)
Extended interface to obtain the public 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_PkeyDecapsInit(CRYPT_EAL_PkeyCtx *pkey, const BSL_Param *params)
Initialize asymmetric key decapsulation context
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.
CRYPT_PKEY_AlgId CRYPT_EAL_PkeyGetId(const CRYPT_EAL_PkeyCtx *pkey)
Obtain the key algorithm type.
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_PkeySetParaEx(CRYPT_EAL_PkeyCtx *pkey, const BSL_Param *param)
Set the key parameters.
int32_t CRYPT_EAL_PkeyCopyCtx(CRYPT_EAL_PkeyCtx *to, const CRYPT_EAL_PkeyCtx *from)
Copy the pkey context.
int32_t CRYPT_EAL_PkeyCmp(const CRYPT_EAL_PkeyCtx *a, const CRYPT_EAL_PkeyCtx *b)
Compare keys or parameters
uint32_t CRYPT_EAL_PkeyGetSecurityBits(const CRYPT_EAL_PkeyCtx *pkey)
Obtain the key security strength. Only supports CRYPT_PKEY_RSA and CRYPT_PKEY_ECDSA.
int32_t CRYPT_EAL_PkeySetExtData(CRYPT_EAL_PkeyCtx *pkey, void *data)
Set the user's personal data.
CRYPT_EAL_PkeyCtx * CRYPT_EAL_PkeyNewCtx(CRYPT_PKEY_AlgId id)
Create an asymmetric key pair structure.
int32_t CRYPT_EAL_PkeySetPubEx(CRYPT_EAL_PkeyCtx *pkey, const BSL_Param *param)
Extended interface to set the public key.
struct EAL_PkeyCtx CRYPT_EAL_PkeyCtx
定义 crypt_eal_pkey.h:108
CRYPT_PKEY_ParaId CRYPT_EAL_PkeyGetParaId(const CRYPT_EAL_PkeyCtx *pkey)
Obtain the key algorithm parameter ID.
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_PkeyUnBlind(CRYPT_EAL_PkeyCtx *pkey, const uint8_t *input, uint32_t inputLen, uint8_t *out, uint32_t *outLen)
Perform unblind operation on blinded data.
int32_t CRYPT_EAL_PkeyUpRef(CRYPT_EAL_PkeyCtx *pkey)
EAL layer reference counting auto-increment
int32_t CRYPT_EAL_PkeyPairCheck(CRYPT_EAL_PkeyCtx *pubKey, CRYPT_EAL_PkeyCtx *prvKey)
Check whether the public and private keys match.
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.
uint32_t CRYPT_EAL_PkeyGetKeyLen(const CRYPT_EAL_PkeyCtx *pkey)
Obtain the number of bytes in the key length.
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_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_PkeySetParaById(CRYPT_EAL_PkeyCtx *pkey, CRYPT_PKEY_ParaId id)
Set key parameters.
void CRYPT_EAL_PkeyFreeCtx(CRYPT_EAL_PkeyCtx *pkey)
Release the asymmetric key pair structure.
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_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_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
bool CRYPT_EAL_PkeyIsValidAlgId(CRYPT_PKEY_AlgId id)
Check whether the id is valid asymmetric algorithm ID.
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_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".
CRYPT_Data CRYPT_KemEncapsKey
定义 crypt_types.h:456
CRYPT_Data CRYPT_EccPub
定义 crypt_types.h:414
CRYPT_Data CRYPT_DsaPrv
定义 crypt_types.h:268
CRYPT_Data CRYPT_DsaPub
定义 crypt_types.h:407
CRYPT_Data CRYPT_MlDsaPrv
定义 crypt_types.h:324
CRYPT_Data CRYPT_KemDecapsKey
定义 crypt_types.h:317
CRYPT_Data CRYPT_DhPrv
定义 crypt_types.h:296
CRYPT_Data CRYPT_Curve25519Prv
定义 crypt_types.h:310
CRYPT_Data CRYPT_EccPrv
定义 crypt_types.h:275
CRYPT_Data CRYPT_Curve25519Pub
定义 crypt_types.h:449
CRYPT_Data CRYPT_MlDsaPub
定义 crypt_types.h:463
CRYPT_Data CRYPT_DhPub
定义 crypt_types.h:435
CRYPT_RsaPara rsaPara
定义 crypt_eal_pkey.h:94
CRYPT_DsaPara dsaPara
定义 crypt_eal_pkey.h:95
CRYPT_PKEY_AlgId id
定义 crypt_eal_pkey.h:92
CRYPT_EccPara eccPara
定义 crypt_eal_pkey.h:97
CRYPT_ElGamalPara elgamalPara
定义 crypt_eal_pkey.h:99
CRYPT_PaillierPara paillierPara
定义 crypt_eal_pkey.h:98
CRYPT_DhPara dhPara
定义 crypt_eal_pkey.h:96
CRYPT_PaillierPrv paillierPrv
定义 crypt_eal_pkey.h:76
CRYPT_DhPrv dhPrv
定义 crypt_eal_pkey.h:73
CRYPT_EccPrv eccPrv
定义 crypt_eal_pkey.h:74
CRYPT_DsaPrv dsaPrv
定义 crypt_eal_pkey.h:72
CRYPT_MlDsaPrv mldsaPrv
定义 crypt_eal_pkey.h:79
CRYPT_ElGamalPrv elgamalPrv
定义 crypt_eal_pkey.h:78
CRYPT_SlhDsaPrv slhDsaPrv
定义 crypt_eal_pkey.h:80
CRYPT_XmssPrv xmssPrv
定义 crypt_eal_pkey.h:81
CRYPT_PKEY_AlgId id
定义 crypt_eal_pkey.h:69
CRYPT_RsaPrv rsaPrv
定义 crypt_eal_pkey.h:71
CRYPT_Curve25519Prv curve25519Prv
定义 crypt_eal_pkey.h:75
CRYPT_KemDecapsKey kemDk
定义 crypt_eal_pkey.h:77
CRYPT_PaillierPub paillierPub
定义 crypt_eal_pkey.h:48
CRYPT_Curve25519Pub curve25519Pub
定义 crypt_eal_pkey.h:47
CRYPT_DsaPub dsaPub
定义 crypt_eal_pkey.h:44
CRYPT_SlhDsaPub slhDsaPub
定义 crypt_eal_pkey.h:52
CRYPT_DhPub dhPub
定义 crypt_eal_pkey.h:45
CRYPT_XmssPub xmssPub
定义 crypt_eal_pkey.h:53
CRYPT_MlDsaPub mldsaPub
定义 crypt_eal_pkey.h:51
CRYPT_KemEncapsKey kemEk
定义 crypt_eal_pkey.h:49
CRYPT_EccPub eccPub
定义 crypt_eal_pkey.h:46
CRYPT_RsaPub rsaPub
定义 crypt_eal_pkey.h:43
CRYPT_ElGamalPub elgamalPub
定义 crypt_eal_pkey.h:50
CRYPT_PKEY_AlgId id
定义 crypt_eal_pkey.h:41
SLH-DSA private key structure
定义 crypt_types.h:365
SLH-DSA public key structure
定义 crypt_types.h:356
XMSS private key structure
定义 crypt_types.h:379