#include "cryptkey.h"
Go to the source code of this file.
Defines | |
#define | GWEN_CRYPT_KEYRSA_FLAGS_DIRECTSIGN 0x00000001 |
#define | GWEN_CRYPT_KEYRSA_MAX_KEYLENGTH 1024 |
Functions | |
GWENHYWFAR_API void | GWEN_Crypt_KeyRsa_AddFlags (GWEN_CRYPT_KEY *k, uint32_t fl) |
GWENHYWFAR_API GWEN_CRYPT_KEY * | GWEN_Crypt_KeyRsa_dup (const GWEN_CRYPT_KEY *k) |
GWENHYWFAR_API GWEN_CRYPT_KEY * | GWEN_Crypt_KeyRsa_fromDb (GWEN_DB_NODE *db) |
GWENHYWFAR_API GWEN_CRYPT_KEY * | GWEN_Crypt_KeyRsa_fromModExp (unsigned int nbytes, const uint8_t *pModulus, uint32_t lModulus, const uint8_t *pExponent, uint32_t lExponent) |
GWENHYWFAR_API GWEN_CRYPT_KEY * | GWEN_Crypt_KeyRsa_fromModPrivExp (unsigned int nbytes, const uint8_t *pModulus, uint32_t lModulus, const uint8_t *pExponent, uint32_t lExponent, const uint8_t *pPrivExponent, uint32_t lPrivExponent) |
GWENHYWFAR_API int | GWEN_Crypt_KeyRsa_GeneratePair (unsigned int nbytes, int use65537e, GWEN_CRYPT_KEY **pPubKey, GWEN_CRYPT_KEY **pSecretKey) |
GWENHYWFAR_API int | GWEN_Crypt_KeyRsa_GeneratePair2 (unsigned int nbits, int use65537e, GWEN_CRYPT_KEY **pPubKey, GWEN_CRYPT_KEY **pSecretKey) |
GWENHYWFAR_API int | GWEN_Crypt_KeyRsa_GetExponent (const GWEN_CRYPT_KEY *k, uint8_t *buffer, uint32_t *pBufLen) |
GWENHYWFAR_API uint32_t | GWEN_Crypt_KeyRsa_GetFlags (const GWEN_CRYPT_KEY *k) |
GWENHYWFAR_API int | GWEN_Crypt_KeyRsa_GetModulus (const GWEN_CRYPT_KEY *k, uint8_t *buffer, uint32_t *pBufLen) |
GWENHYWFAR_API int | GWEN_Crypt_KeyRsa_GetSecretExponent (const GWEN_CRYPT_KEY *k, uint8_t *buffer, uint32_t *pBufLen) |
GWENHYWFAR_API void | GWEN_Crypt_KeyRsa_SetFlags (GWEN_CRYPT_KEY *k, uint32_t fl) |
GWENHYWFAR_API void | GWEN_Crypt_KeyRsa_SubFlags (GWEN_CRYPT_KEY *k, uint32_t fl) |
GWENHYWFAR_API int | GWEN_Crypt_KeyRsa_toDb (const GWEN_CRYPT_KEY *k, GWEN_DB_NODE *db, int pub) |
#define GWEN_CRYPT_KEYRSA_FLAGS_DIRECTSIGN 0x00000001 |
When signing always directly use the signature, do not determine whether (sig-n) is smaller
Definition at line 24 of file cryptkeyrsa.h.
Referenced by GWEN_Crypt_KeyRsa_Sign(), GWEN_Crypt_TokenFile__ActivateKey(), and GWEN_Crypt_TokenFile__GenerateKey().
#define GWEN_CRYPT_KEYRSA_MAX_KEYLENGTH 1024 |
Definition at line 27 of file cryptkeyrsa.h.
GWENHYWFAR_API void GWEN_Crypt_KeyRsa_AddFlags | ( | GWEN_CRYPT_KEY * | k, | |
uint32_t | fl | |||
) |
Definition at line 1183 of file cryptkeyrsa.c.
References GWEN_INHERIT_GETDATA.
Referenced by GWEN_Crypt_TokenFile__ActivateKey(), and GWEN_Crypt_TokenFile__GenerateKey().
GWENHYWFAR_API GWEN_CRYPT_KEY* GWEN_Crypt_KeyRsa_dup | ( | const GWEN_CRYPT_KEY * | k | ) |
Definition at line 1128 of file cryptkeyrsa.c.
References DBG_INFO, GWEN_Crypt_KeyRsa_fromDb(), GWEN_Crypt_KeyRsa_SetFlags(), GWEN_Crypt_KeyRsa_toDb(), GWEN_DB_Group_free(), GWEN_DB_Group_new(), GWEN_INHERIT_GETDATA, GWEN_LOGDOMAIN, and NULL.
Referenced by GWEN_Crypt_TokenFile__ActivateKey().
GWENHYWFAR_API GWEN_CRYPT_KEY* GWEN_Crypt_KeyRsa_fromDb | ( | GWEN_DB_NODE * | db | ) |
Definition at line 527 of file cryptkeyrsa.c.
References DBG_ERROR, DBG_INFO, GWEN_Crypt_Key_free(), GWEN_Crypt_Key_fromDb(), GWEN_Crypt_Key_GetCryptAlgoId(), GWEN_Crypt_Key_GetKeySize(), GWEN_Crypt_Key_SetDecipherFn(), GWEN_Crypt_Key_SetEncipherFn(), GWEN_Crypt_Key_SetSignFn(), GWEN_Crypt_Key_SetVerifyFn(), GWEN_Crypt_KeyRsa__DataFromDb(), GWEN_Crypt_KeyRsa_Decipher(), GWEN_Crypt_KeyRsa_Encipher(), GWEN_Crypt_KeyRsa_freeData(), GWEN_Crypt_KeyRsa_Sign(), GWEN_Crypt_KeyRsa_Verify(), GWEN_DB_GetGroup(), GWEN_DB_GetIntValue(), GWEN_INHERIT_SETDATA, GWEN_LOGDOMAIN, GWEN_NEW_OBJECT, GWEN_PATH_FLAGS_NAMEMUSTEXIST, and NULL.
Referenced by GWEN_Crypt_KeyRsa_dup(), GWEN_Crypt_KeyRsa_fromModExp(), and GWEN_Crypt_KeyRsa_fromModPrivExp().
GWENHYWFAR_API GWEN_CRYPT_KEY* GWEN_Crypt_KeyRsa_fromModExp | ( | unsigned int | nbytes, | |
const uint8_t * | pModulus, | |||
uint32_t | lModulus, | |||
const uint8_t * | pExponent, | |||
uint32_t | lExponent | |||
) |
Definition at line 1019 of file cryptkeyrsa.c.
References DBG_INFO, GWEN_Crypt_CryptAlgoId_toString(), GWEN_Crypt_KeyRsa_fromDb(), GWEN_DB_Dump(), GWEN_DB_FLAGS_OVERWRITE_GROUPS, GWEN_DB_FLAGS_OVERWRITE_VARS, GWEN_DB_GetGroup(), GWEN_DB_Group_free(), GWEN_DB_Group_new(), GWEN_DB_SetBinValue(), GWEN_DB_SetCharValue(), GWEN_DB_SetIntValue(), GWEN_LOGDOMAIN, and NULL.
Referenced by GWEN_Crypt_TokenFile__SetKeyInfo().
GWENHYWFAR_API GWEN_CRYPT_KEY* GWEN_Crypt_KeyRsa_fromModPrivExp | ( | unsigned int | nbytes, | |
const uint8_t * | pModulus, | |||
uint32_t | lModulus, | |||
const uint8_t * | pExponent, | |||
uint32_t | lExponent, | |||
const uint8_t * | pPrivExponent, | |||
uint32_t | lPrivExponent | |||
) |
Definition at line 1070 of file cryptkeyrsa.c.
References DBG_INFO, GWEN_Crypt_CryptAlgoId_toString(), GWEN_Crypt_KeyRsa_fromDb(), GWEN_DB_Dump(), GWEN_DB_FLAGS_OVERWRITE_GROUPS, GWEN_DB_FLAGS_OVERWRITE_VARS, GWEN_DB_GetGroup(), GWEN_DB_Group_free(), GWEN_DB_Group_new(), GWEN_DB_SetBinValue(), GWEN_DB_SetCharValue(), GWEN_DB_SetIntValue(), GWEN_LOGDOMAIN, and NULL.
GWENHYWFAR_API int GWEN_Crypt_KeyRsa_GeneratePair | ( | unsigned int | nbytes, | |
int | use65537e, | |||
GWEN_CRYPT_KEY ** | pPubKey, | |||
GWEN_CRYPT_KEY ** | pSecretKey | |||
) |
Creates a key pair and returns a pointer to it.
nbytes | number of bytes | |
use65537e | !=0: use the value 65537 for the public exponent, otherwise let the library choose the exponent by its own |
Definition at line 941 of file cryptkeyrsa.c.
References GWEN_Crypt_KeyRsa_GeneratePair2().
Referenced by GWEN_Crypt_TokenFile__GenerateKey().
GWENHYWFAR_API int GWEN_Crypt_KeyRsa_GeneratePair2 | ( | unsigned int | nbits, | |
int | use65537e, | |||
GWEN_CRYPT_KEY ** | pPubKey, | |||
GWEN_CRYPT_KEY ** | pSecretKey | |||
) |
Creates a key pair and returns a pointer to it. This function allows for more precise control over the size of the created key because it lets you specify the size in bits rather than in bytes.
nbits | number of bits | |
use65537e | !=0: use the value 65537 for the public exponent, otherwise let the library choose the exponent by its own |
Definition at line 757 of file cryptkeyrsa.c.
References DBG_ERROR, DBG_INFO, GWEN_Crypt_Key_free(), GWEN_Crypt_Key_new(), GWEN_Crypt_Key_SetDecipherFn(), GWEN_Crypt_Key_SetEncipherFn(), GWEN_Crypt_Key_SetSignFn(), GWEN_Crypt_Key_SetVerifyFn(), GWEN_Crypt_KeyRsa__sKeyToDataPrivKey(), GWEN_Crypt_KeyRsa__sKeyToDataPubKey(), GWEN_Crypt_KeyRsa_Decipher(), GWEN_Crypt_KeyRsa_Encipher(), GWEN_Crypt_KeyRsa_freeData(), GWEN_Crypt_KeyRsa_Sign(), GWEN_Crypt_KeyRsa_Verify(), GWEN_INHERIT_SETDATA, GWEN_LOGDOMAIN, and GWEN_NEW_OBJECT.
Referenced by GWEN_Crypt_KeyRsa_GeneratePair(), and GWEN_Crypt_TokenFile__GenerateKey().
GWENHYWFAR_API int GWEN_Crypt_KeyRsa_GetExponent | ( | const GWEN_CRYPT_KEY * | k, | |
uint8_t * | buffer, | |||
uint32_t * | pBufLen | |||
) |
Definition at line 1007 of file cryptkeyrsa.c.
References GWEN_Crypt_KeyRsa__GetNamedElement().
Referenced by GWEN_Crypt_TokenFile__ActivateKey(), and GWEN_Crypt_TokenFile__GenerateKey().
GWENHYWFAR_API uint32_t GWEN_Crypt_KeyRsa_GetFlags | ( | const GWEN_CRYPT_KEY * | k | ) |
Definition at line 1159 of file cryptkeyrsa.c.
References GWEN_INHERIT_GETDATA.
GWENHYWFAR_API int GWEN_Crypt_KeyRsa_GetModulus | ( | const GWEN_CRYPT_KEY * | k, | |
uint8_t * | buffer, | |||
uint32_t * | pBufLen | |||
) |
Definition at line 1001 of file cryptkeyrsa.c.
References GWEN_Crypt_KeyRsa__GetNamedElement().
Referenced by GWEN_Crypt_TokenFile__ActivateKey(), and GWEN_Crypt_TokenFile__GenerateKey().
GWENHYWFAR_API int GWEN_Crypt_KeyRsa_GetSecretExponent | ( | const GWEN_CRYPT_KEY * | k, | |
uint8_t * | buffer, | |||
uint32_t * | pBufLen | |||
) |
Definition at line 1013 of file cryptkeyrsa.c.
References GWEN_Crypt_KeyRsa__GetNamedElement().
GWENHYWFAR_API void GWEN_Crypt_KeyRsa_SetFlags | ( | GWEN_CRYPT_KEY * | k, | |
uint32_t | fl | |||
) |
Definition at line 1171 of file cryptkeyrsa.c.
References GWEN_INHERIT_GETDATA.
Referenced by GWEN_Crypt_KeyRsa_dup().
GWENHYWFAR_API void GWEN_Crypt_KeyRsa_SubFlags | ( | GWEN_CRYPT_KEY * | k, | |
uint32_t | fl | |||
) |
Definition at line 1195 of file cryptkeyrsa.c.
References GWEN_INHERIT_GETDATA.
GWENHYWFAR_API int GWEN_Crypt_KeyRsa_toDb | ( | const GWEN_CRYPT_KEY * | k, | |
GWEN_DB_NODE * | db, | |||
int | pub | |||
) |
Definition at line 607 of file cryptkeyrsa.c.
References DBG_ERROR, DBG_INFO, GWEN_Crypt_Key_toDb(), GWEN_Crypt_KeyRsa__WriteMpi(), GWEN_DB_FLAGS_OVERWRITE_GROUPS, GWEN_DB_FLAGS_OVERWRITE_VARS, GWEN_DB_GetGroup(), GWEN_DB_SetIntValue(), GWEN_INHERIT_GETDATA, and GWEN_LOGDOMAIN.
Referenced by GWEN_Crypt_KeyRsa_dup().