![]() |
API参考
|
the asym key module 更多...

类 | |
| struct | RSA_PadingPara |
| struct | CRYPT_EAL_PkeyPub |
| struct | CRYPT_EAL_PkeyPrv |
| struct | CRYPT_EAL_PkeyPara |
类型定义 | |
| typedef struct EAL_PkeyCtx | CRYPT_EAL_PkeyCtx |
函数 | |
| CRYPT_EAL_PkeyCtx * | CRYPT_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_PkeyCtx * | CRYPT_EAL_PkeyNewCtx (CRYPT_PKEY_AlgId id) |
| Create an asymmetric key pair structure. | |
| 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. | |
| int32_t | CRYPT_EAL_PkeyCopyCtx (CRYPT_EAL_PkeyCtx *to, const CRYPT_EAL_PkeyCtx *from) |
| Copy the pkey context. | |
| 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. | |
| 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
| typedef struct EAL_PkeyCtx CRYPT_EAL_PkeyCtx |
Pkey session structure.
| 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_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. |
| 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,if | successful. For other error codes, see crypt_errno.h. |
| 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,a | and b are the same(include both a and b are null) |
| CRYPT_NULL_INPUT,incorrect | null pointer input. |
| For | other error codes, see crypt_errno.h. |
| 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,if | successful. For other error codes, see crypt_errno.h. |
| int32_t CRYPT_EAL_PkeyCopyCtx | ( | CRYPT_EAL_PkeyCtx * | to, |
| const CRYPT_EAL_PkeyCtx * | from ) |
Copy the pkey context.
| to | [IN/OUT] Target pkey context |
| from | [IN] Source pkey context |
| CRYPT_SUCCESS | For other error codes, see crypt_errno.h. |
| 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,if | successful. For other error codes, see crypt_errno.h. |
| 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_SUCCESS | For other error codes see crypt_errno.h. |
| 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_SUCCESS | For other error codes see crypt_errno.h. |
| 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,if | successful. For other error codes, see crypt_errno.h. |
| 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,Pkey | context pointer. NULL, if the operation fails. |
| 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_SUCCESS | For other error codes see crypt_errno.h. |
| 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_SUCCESS | For other error codes see crypt_errno.h. |
| 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,if | successful. For other error codes, see crypt_errno.h. |
| 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. |
| int32_t CRYPT_EAL_PkeyGen | ( | CRYPT_EAL_PkeyCtx * | pkey | ) |
Generate the key data.
| pkey | [IN/OUT] Key pair structure for receiving key data. |
| CRYPT_SUCCESS | For other error codes, see crypt_errno.h. |
| void * CRYPT_EAL_PkeyGetExtData | ( | const CRYPT_EAL_PkeyCtx * | pkey | ) |
Obtain the user's personal data.
| pkey | [IN] Key session |
| void*(user | personal data pointer), which indicates successful. NULL, which indicates failed. |
| CRYPT_PKEY_AlgId CRYPT_EAL_PkeyGetId | ( | const CRYPT_EAL_PkeyCtx * | pkey | ) |
Obtain the key algorithm type.
| pkey | [IN] Key session |
| Key | algorithm type |
| uint32_t CRYPT_EAL_PkeyGetKeyBits | ( | const CRYPT_EAL_PkeyCtx * | pkey | ) |
Obtain the number of bits in the key length.
| pkey | [IN] Key session |
| Number | of key bits, if successful. 0, if failed. |
| uint32_t CRYPT_EAL_PkeyGetKeyLen | ( | const CRYPT_EAL_PkeyCtx * | pkey | ) |
Obtain the number of bytes in the key length.
| pkey | [IN] Key session |
| Key | length, if successful. 0, if failed. |
| 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_SUCCESS | For other error codes, see crypt_errno.h. |
| CRYPT_PKEY_ParaId CRYPT_EAL_PkeyGetParaId | ( | const CRYPT_EAL_PkeyCtx * | pkey | ) |
Obtain the key algorithm parameter ID.
| pkey | [IN] Key session |
| Algorithm | parameter 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".
| pkey | [IN] Key session |
| key | [OUT] Private key data |
| CRYPT_SUCCESS | For other error codes, see crypt_errno.h. |
| 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_SUCCESS | For other error codes, see crypt_errno.h. |
| 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_SUCCESS | For other error codes, see crypt_errno.h. |
| 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_SUCCESS | For other error codes, see crypt_errno.h. |
| 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 |
| Key | security strength, if successful. 0, if failed. |
| 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 |
| Signature | length, if successful. 0, if failed. |
| 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,if | successful. For other error codes, see crypt_errno.h. |
| 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,if | successful. For other error codes, see crypt_errno.h. |
| bool CRYPT_EAL_PkeyIsValidAlgId | ( | CRYPT_PKEY_AlgId | id | ) |
Check whether the id is valid asymmetric algorithm ID.
| id | [IN] Asymmetric algorithm ID |
| true,if | the value is valid. false, if the value is invalid. |
| CRYPT_EAL_PkeyCtx * CRYPT_EAL_PkeyNewCtx | ( | CRYPT_PKEY_AlgId | id | ) |
Create an asymmetric key pair structure.
| id | [IN] Algorithm ID |
| CRYPT_EAL_PkeyCtx | pointer. NULL, if the operation fails. |
| int32_t CRYPT_EAL_PkeyPairCheck | ( | CRYPT_EAL_PkeyCtx * | pubKey, |
| CRYPT_EAL_PkeyCtx * | prvKey ) |
Check whether the public and private keys match.
| pubKey | [IN] Public key |
| prvKey | [IN] private key |
| CRYPT_SUCCESS,if | successful. For other error codes, see crypt_errno.h. |
| int32_t CRYPT_EAL_PkeyPrvCheck | ( | CRYPT_EAL_PkeyCtx * | prvKey | ) |
Check the private key is valid.
| prvKey | [IN] Private key |
| CRYPT_SUCCESS,if | successful. For other error codes, see crypt_errno.h. |
| 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,if | successful. |
| CRYPT_NULL_INPUT,if | pkey is NULL. |
| 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_SUCCESS | For other error codes, see crypt_errno.h. |
| 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_SUCCESS | For other error codes, see crypt_errno.h. |
| 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_SUCCESS | For other error codes, see crypt_errno.h. |
| 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_SUCCESS | For other error codes, see crypt_errno.h. |
| 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_SUCCESS | For other error codes, see crypt_errno.h. |
| 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_SUCCESS | For other error codes, see crypt_errno.h. |
| 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_SUCCESS | For other error codes, see crypt_errno.h. |
| 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_SUCCESS | For other error codes, see crypt_errno.h. |
| 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,if | successful. For other error codes see crypt_errno.h |
| 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,if | successful. For other error codes, see crypt_errno.h. |
| int32_t CRYPT_EAL_PkeyUpRef | ( | CRYPT_EAL_PkeyCtx * | pkey | ) |
EAL layer reference counting auto-increment
| pkey | [IN] Key session |
| CRYPT_SUCCESS | For other error codes see crypt_errno.h. |
| 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_SUCCESS | For other error codes, see crypt_errno.h. |
| 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,if | successful. For other error codes, see crypt_errno.h. |
| 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_PkeyCtx | pointer. NULL, if the operation fails. |