GNUnet 0.22.2
crypto_pkey.c File Reference

api to interact handle generic public keys More...

#include "platform.h"
#include "gnunet_util_lib.h"
Include dependency graph for crypto_pkey.c:

Go to the source code of this file.

Functions

static enum GNUNET_GenericReturnValue check_key_type (uint32_t type)
 
void GNUNET_CRYPTO_private_key_clear (struct GNUNET_CRYPTO_PrivateKey *key)
 Clear memory that was used to store a private key. More...
 
ssize_t GNUNET_CRYPTO_private_key_get_length (const struct GNUNET_CRYPTO_PrivateKey *key)
 Get the compacted length of a GNUNET_CRYPTO_PrivateKey. More...
 
ssize_t GNUNET_CRYPTO_public_key_get_length (const struct GNUNET_CRYPTO_PublicKey *key)
 Get the compacted length of a GNUNET_CRYPTO_PublicKey. More...
 
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_read_public_key_from_buffer (const void *buffer, size_t len, struct GNUNET_CRYPTO_PublicKey *key, size_t *kb_read)
 Reads a GNUNET_CRYPTO_PublicKey from a compact buffer. More...
 
ssize_t GNUNET_CRYPTO_write_public_key_to_buffer (const struct GNUNET_CRYPTO_PublicKey *key, void *buffer, size_t len)
 Writes a GNUNET_CRYPTO_PublicKey to a compact buffer. More...
 
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_read_private_key_from_buffer (const void *buffer, size_t len, struct GNUNET_CRYPTO_PrivateKey *key, size_t *kb_read)
 Reads a GNUNET_CRYPTO_PrivateKey from a compact buffer. More...
 
ssize_t GNUNET_CRYPTO_write_private_key_to_buffer (const struct GNUNET_CRYPTO_PrivateKey *key, void *buffer, size_t len)
 Writes a GNUNET_CRYPTO_PrivateKey to a compact buffer. More...
 
ssize_t GNUNET_CRYPTO_signature_get_length (const struct GNUNET_CRYPTO_Signature *sig)
 Get the compacted length of a GNUNET_CRYPTO_Signature. More...
 
ssize_t GNUNET_CRYPTO_signature_get_raw_length_by_type (uint32_t type)
 Get the compacted length of a signature by type. More...
 
ssize_t GNUNET_CRYPTO_read_signature_from_buffer (struct GNUNET_CRYPTO_Signature *sig, const void *buffer, size_t len)
 Reads a GNUNET_CRYPTO_Signature from a compact buffer. More...
 
ssize_t GNUNET_CRYPTO_write_signature_to_buffer (const struct GNUNET_CRYPTO_Signature *sig, void *buffer, size_t len)
 Writes a GNUNET_CRYPTO_Signature to a compact buffer. More...
 
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_sign_raw_ (const struct GNUNET_CRYPTO_PrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, unsigned char *sig)
 Sign a given block. More...
 
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_sign_ (const struct GNUNET_CRYPTO_PrivateKey *priv, const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, struct GNUNET_CRYPTO_Signature *sig)
 Sign a given block. More...
 
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_signature_verify_ (uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const struct GNUNET_CRYPTO_Signature *sig, const struct GNUNET_CRYPTO_PublicKey *pub)
 Verify a given signature. More...
 
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_signature_verify_raw_ (uint32_t purpose, const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, const unsigned char *sig, const struct GNUNET_CRYPTO_PublicKey *pub)
 Verify a given signature. More...
 
char * GNUNET_CRYPTO_public_key_to_string (const struct GNUNET_CRYPTO_PublicKey *key)
 Creates a (Base32) string representation of the public key. More...
 
char * GNUNET_CRYPTO_private_key_to_string (const struct GNUNET_CRYPTO_PrivateKey *key)
 Creates a (Base32) string representation of the private key. More...
 
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_public_key_from_string (const char *str, struct GNUNET_CRYPTO_PublicKey *key)
 Parses a (Base32) string representation of the public key. More...
 
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_private_key_from_string (const char *str, struct GNUNET_CRYPTO_PrivateKey *key)
 Parses a (Base32) string representation of the private key. More...
 
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_key_get_public (const struct GNUNET_CRYPTO_PrivateKey *privkey, struct GNUNET_CRYPTO_PublicKey *key)
 Retrieves the public key representation of a private key. More...
 

Detailed Description

api to interact handle generic public keys

Author
Martin Schanzenbach

Definition in file crypto_pkey.c.

Function Documentation

◆ check_key_type()

static enum GNUNET_GenericReturnValue check_key_type ( uint32_t  type)
static

Definition at line 32 of file crypto_pkey.c.

33{
34 switch (type)
35 {
38 return GNUNET_OK;
39 default:
40 return GNUNET_SYSERR;
41 }
42 return GNUNET_SYSERR;
43}
static uint32_t type
Type string converted to DNS type value.
@ GNUNET_PUBLIC_KEY_TYPE_EDDSA
EDDSA identity.
@ GNUNET_PUBLIC_KEY_TYPE_ECDSA
The identity type.
@ GNUNET_OK
@ GNUNET_SYSERR

References GNUNET_OK, GNUNET_PUBLIC_KEY_TYPE_ECDSA, GNUNET_PUBLIC_KEY_TYPE_EDDSA, GNUNET_SYSERR, and type.

Referenced by GNUNET_CRYPTO_private_key_from_string(), and GNUNET_CRYPTO_public_key_from_string().

Here is the caller graph for this function: