#include "cryptkeyrsa_p.h"
#include <gwenhywfar/misc.h>
#include <gwenhywfar/debug.h>
#include <gwenhywfar/text.h>
Go to the source code of this file.
Functions | |
int | GWEN_Crypt_KeyRsa__DataFromDb (GWEN_DB_NODE *db, gcry_ac_data_t *pData, int pub, unsigned int nbits) |
int | GWEN_Crypt_KeyRsa__GetNamedElement (const GWEN_CRYPT_KEY *k, const char *name, uint8_t *buffer, uint32_t *pBufLen) |
int | GWEN_Crypt_KeyRsa__ReadMpi (GWEN_DB_NODE *db, const char *dbName, gcry_ac_data_t ds, const char *dsName) |
int | GWEN_Crypt_KeyRsa__sKeyElementToData (gcry_ac_data_t data, gcry_sexp_t sx, const char *name) |
int | GWEN_Crypt_KeyRsa__sKeyToDataPrivKey (gcry_ac_data_t data, gcry_sexp_t sx) |
int | GWEN_Crypt_KeyRsa__sKeyToDataPubKey (gcry_ac_data_t data, gcry_sexp_t sx) |
int | GWEN_Crypt_KeyRsa__WriteMpi (GWEN_DB_NODE *db, const char *dbName, gcry_ac_data_t ds, const char *dsName) |
void | GWEN_Crypt_KeyRsa_AddFlags (GWEN_CRYPT_KEY *k, uint32_t fl) |
int | GWEN_Crypt_KeyRsa_Decipher (GWEN_CRYPT_KEY *k, const uint8_t *pInData, uint32_t inLen, uint8_t *pOutData, uint32_t *pOutLen) |
GWEN_CRYPT_KEY * | GWEN_Crypt_KeyRsa_dup (const GWEN_CRYPT_KEY *k) |
int | GWEN_Crypt_KeyRsa_Encipher (GWEN_CRYPT_KEY *k, const uint8_t *pInData, uint32_t inLen, uint8_t *pOutData, uint32_t *pOutLen) |
GWENHYWFAR_CB void | GWEN_Crypt_KeyRsa_freeData (void *bp, void *p) |
GWEN_CRYPT_KEY * | GWEN_Crypt_KeyRsa_fromDb (GWEN_DB_NODE *db) |
GWEN_CRYPT_KEY * | GWEN_Crypt_KeyRsa_fromModExp (unsigned int nbytes, const uint8_t *pModulus, uint32_t lModulus, const uint8_t *pExponent, uint32_t lExponent) |
int | GWEN_Crypt_KeyRsa_GeneratePair (unsigned int nbytes, int use65537e, GWEN_CRYPT_KEY **pPubKey, GWEN_CRYPT_KEY **pSecretKey) |
int | GWEN_Crypt_KeyRsa_GetExponent (const GWEN_CRYPT_KEY *k, uint8_t *buffer, uint32_t *pBufLen) |
uint32_t | GWEN_Crypt_KeyRsa_GetFlags (const GWEN_CRYPT_KEY *k) |
int | GWEN_Crypt_KeyRsa_GetModulus (const GWEN_CRYPT_KEY *k, uint8_t *buffer, uint32_t *pBufLen) |
void | GWEN_Crypt_KeyRsa_SetFlags (GWEN_CRYPT_KEY *k, uint32_t fl) |
int | GWEN_Crypt_KeyRsa_Sign (GWEN_CRYPT_KEY *k, const uint8_t *pInData, uint32_t inLen, uint8_t *pSignatureData, uint32_t *pSignatureLen) |
void | GWEN_Crypt_KeyRsa_SubFlags (GWEN_CRYPT_KEY *k, uint32_t fl) |
int | GWEN_Crypt_KeyRsa_toDb (const GWEN_CRYPT_KEY *k, GWEN_DB_NODE *db, int pub) |
int | GWEN_Crypt_KeyRsa_Verify (GWEN_CRYPT_KEY *k, const uint8_t *pInData, uint32_t inLen, const uint8_t *pSignatureData, uint32_t signatureLen) |
int GWEN_Crypt_KeyRsa__DataFromDb | ( | GWEN_DB_NODE * | db, | |
gcry_ac_data_t * | pData, | |||
int | pub, | |||
unsigned int | nbits | |||
) |
Definition at line 453 of file cryptkeyrsa.c.
References DBG_INFO, GWEN_Crypt_KeyRsa__ReadMpi(), GWEN_ERROR_GENERIC, and GWEN_LOGDOMAIN.
Referenced by GWEN_Crypt_KeyRsa_fromDb().
int GWEN_Crypt_KeyRsa__GetNamedElement | ( | const GWEN_CRYPT_KEY * | k, | |
const char * | name, | |||
uint8_t * | buffer, | |||
uint32_t * | pBufLen | |||
) |
Definition at line 924 of file cryptkeyrsa.c.
References DBG_INFO, GWEN_ERROR_BUFFER_OVERFLOW, GWEN_ERROR_GENERIC, GWEN_ERROR_NO_DATA, GWEN_INHERIT_GETDATA, and GWEN_LOGDOMAIN.
Referenced by GWEN_Crypt_KeyRsa_GetExponent(), and GWEN_Crypt_KeyRsa_GetModulus().
int GWEN_Crypt_KeyRsa__ReadMpi | ( | GWEN_DB_NODE * | db, | |
const char * | dbName, | |||
gcry_ac_data_t | ds, | |||
const char * | dsName | |||
) |
Definition at line 373 of file cryptkeyrsa.c.
References DBG_INFO, GWEN_DB_GetBinValue(), GWEN_ERROR_BAD_DATA, GWEN_ERROR_GENERIC, GWEN_ERROR_NO_DATA, GWEN_LOGDOMAIN, and NULL.
Referenced by GWEN_Crypt_KeyRsa__DataFromDb().
int GWEN_Crypt_KeyRsa__sKeyElementToData | ( | gcry_ac_data_t | data, | |
gcry_sexp_t | sx, | |||
const char * | name | |||
) |
Definition at line 685 of file cryptkeyrsa.c.
References DBG_ERROR, DBG_INFO, GWEN_ERROR_GENERIC, GWEN_LOGDOMAIN, and NULL.
Referenced by GWEN_Crypt_KeyRsa__sKeyToDataPrivKey(), and GWEN_Crypt_KeyRsa__sKeyToDataPubKey().
int GWEN_Crypt_KeyRsa__sKeyToDataPrivKey | ( | gcry_ac_data_t | data, | |
gcry_sexp_t | sx | |||
) |
Definition at line 724 of file cryptkeyrsa.c.
References GWEN_Crypt_KeyRsa__sKeyElementToData().
Referenced by GWEN_Crypt_KeyRsa_GeneratePair().
int GWEN_Crypt_KeyRsa__sKeyToDataPubKey | ( | gcry_ac_data_t | data, | |
gcry_sexp_t | sx | |||
) |
Definition at line 710 of file cryptkeyrsa.c.
References GWEN_Crypt_KeyRsa__sKeyElementToData().
Referenced by GWEN_Crypt_KeyRsa_GeneratePair().
int GWEN_Crypt_KeyRsa__WriteMpi | ( | GWEN_DB_NODE * | db, | |
const char * | dbName, | |||
gcry_ac_data_t | ds, | |||
const char * | dsName | |||
) |
Definition at line 417 of file cryptkeyrsa.c.
References DBG_INFO, GWEN_DB_FLAGS_OVERWRITE_VARS, GWEN_DB_SetBinValue(), GWEN_ERROR_GENERIC, GWEN_ERROR_NO_DATA, and GWEN_LOGDOMAIN.
Referenced by GWEN_Crypt_KeyRsa_toDb().
void GWEN_Crypt_KeyRsa_AddFlags | ( | GWEN_CRYPT_KEY * | k, | |
uint32_t | fl | |||
) |
Definition at line 1095 of file cryptkeyrsa.c.
References GWEN_INHERIT_GETDATA.
Referenced by GWEN_Crypt_TokenFile__GenerateKey().
int GWEN_Crypt_KeyRsa_Decipher | ( | GWEN_CRYPT_KEY * | k, | |
const uint8_t * | pInData, | |||
uint32_t | inLen, | |||
uint8_t * | pOutData, | |||
uint32_t * | pOutLen | |||
) |
Definition at line 304 of file cryptkeyrsa.c.
References DBG_INFO, GWEN_Crypt_Key_GetKeySize(), GWEN_ERROR_BAD_DATA, GWEN_INHERIT_GETDATA, and GWEN_LOGDOMAIN.
Referenced by GWEN_Crypt_KeyRsa_fromDb(), and GWEN_Crypt_KeyRsa_GeneratePair().
GWEN_CRYPT_KEY* GWEN_Crypt_KeyRsa_dup | ( | const GWEN_CRYPT_KEY * | k | ) |
Definition at line 1040 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.
int GWEN_Crypt_KeyRsa_Encipher | ( | GWEN_CRYPT_KEY * | k, | |
const uint8_t * | pInData, | |||
uint32_t | inLen, | |||
uint8_t * | pOutData, | |||
uint32_t * | pOutLen | |||
) |
Definition at line 235 of file cryptkeyrsa.c.
References DBG_INFO, GWEN_Crypt_Key_GetKeySize(), GWEN_ERROR_BAD_DATA, GWEN_INHERIT_GETDATA, and GWEN_LOGDOMAIN.
Referenced by GWEN_Crypt_KeyRsa_fromDb(), and GWEN_Crypt_KeyRsa_GeneratePair().
GWENHYWFAR_CB void GWEN_Crypt_KeyRsa_freeData | ( | void * | bp, | |
void * | p | |||
) |
Definition at line 510 of file cryptkeyrsa.c.
References GWEN_FREE_OBJECT.
Referenced by GWEN_Crypt_KeyRsa_fromDb(), and GWEN_Crypt_KeyRsa_GeneratePair().
GWEN_CRYPT_KEY* GWEN_Crypt_KeyRsa_fromDb | ( | GWEN_DB_NODE * | db | ) |
Definition at line 523 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(), and GWEN_Crypt_KeyRsa_fromModExp().
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 989 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().
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.
nbits | 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 747 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_ERROR_GENERIC, GWEN_INHERIT_SETDATA, GWEN_LOGDOMAIN, and GWEN_NEW_OBJECT.
Referenced by GWEN_Crypt_TokenFile__GenerateKey().
int GWEN_Crypt_KeyRsa_GetExponent | ( | const GWEN_CRYPT_KEY * | k, | |
uint8_t * | buffer, | |||
uint32_t * | pBufLen | |||
) |
Definition at line 983 of file cryptkeyrsa.c.
References GWEN_Crypt_KeyRsa__GetNamedElement().
Referenced by GWEN_Crypt_TokenFile__GenerateKey().
uint32_t GWEN_Crypt_KeyRsa_GetFlags | ( | const GWEN_CRYPT_KEY * | k | ) |
int GWEN_Crypt_KeyRsa_GetModulus | ( | const GWEN_CRYPT_KEY * | k, | |
uint8_t * | buffer, | |||
uint32_t * | pBufLen | |||
) |
Definition at line 977 of file cryptkeyrsa.c.
References GWEN_Crypt_KeyRsa__GetNamedElement().
Referenced by GWEN_Crypt_TokenFile__GenerateKey().
void GWEN_Crypt_KeyRsa_SetFlags | ( | GWEN_CRYPT_KEY * | k, | |
uint32_t | fl | |||
) |
Definition at line 1083 of file cryptkeyrsa.c.
References GWEN_INHERIT_GETDATA.
Referenced by GWEN_Crypt_KeyRsa_dup().
int GWEN_Crypt_KeyRsa_Sign | ( | GWEN_CRYPT_KEY * | k, | |
const uint8_t * | pInData, | |||
uint32_t | inLen, | |||
uint8_t * | pSignatureData, | |||
uint32_t * | pSignatureLen | |||
) |
Definition at line 63 of file cryptkeyrsa.c.
References DBG_ERROR, DBG_INFO, GWEN_Crypt_Key_GetKeySize(), GWEN_CRYPT_KEYRSA_FLAGS_DIRECTSIGN, GWEN_ERROR_BAD_DATA, GWEN_INHERIT_GETDATA, GWEN_LOGDOMAIN, and NULL.
Referenced by GWEN_Crypt_KeyRsa_fromDb(), and GWEN_Crypt_KeyRsa_GeneratePair().
void GWEN_Crypt_KeyRsa_SubFlags | ( | GWEN_CRYPT_KEY * | k, | |
uint32_t | fl | |||
) |
int GWEN_Crypt_KeyRsa_toDb | ( | const GWEN_CRYPT_KEY * | k, | |
GWEN_DB_NODE * | db, | |||
int | pub | |||
) |
Definition at line 603 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_ERROR_INVALID, GWEN_ERROR_NOT_OPEN, GWEN_INHERIT_GETDATA, and GWEN_LOGDOMAIN.
Referenced by GWEN_Crypt_KeyRsa_dup().
int GWEN_Crypt_KeyRsa_Verify | ( | GWEN_CRYPT_KEY * | k, | |
const uint8_t * | pInData, | |||
uint32_t | inLen, | |||
const uint8_t * | pSignatureData, | |||
uint32_t | signatureLen | |||
) |
Definition at line 145 of file cryptkeyrsa.c.
References DBG_ERROR, DBG_INFO, GWEN_Crypt_Key_GetKeySize(), GWEN_ERROR_BAD_DATA, GWEN_ERROR_VERIFY, GWEN_INHERIT_GETDATA, and GWEN_LOGDOMAIN.
Referenced by GWEN_Crypt_KeyRsa_fromDb(), and GWEN_Crypt_KeyRsa_GeneratePair().