ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
openpgp.h
Go to the documentation of this file.
1#pragma once
2
30#include "../../common.h"
31#include <stdint.h>
32#include <stddef.h>
33#include <stdbool.h>
34
41#define OPENPGP_TAG_PUBLIC_KEY 6
42
44#define OPENPGP_TAG_SECRET_KEY 5
45
47#define OPENPGP_TAG_USER_ID 13
48
50#define OPENPGP_TAG_SIGNATURE 2
51
53#define OPENPGP_ALGO_EDDSA 22
54
56#define OPENPGP_ALGO_ECDH 18
57
71typedef struct {
73 size_t length;
74 size_t header_len;
77
98
121
158asciichat_error_t openpgp_parse_armored_pubkey(const char *armored_text, uint8_t ed25519_pk[32]);
159
190asciichat_error_t openpgp_parse_armored_seckey(const char *armored_text, uint8_t ed25519_pk[32],
191 uint8_t ed25519_sk[32]);
192
216
237asciichat_error_t openpgp_parse_public_key_packet(const uint8_t *packet_body, size_t body_len,
238 openpgp_public_key_t *pubkey);
239
263asciichat_error_t openpgp_parse_secret_key_packet(const uint8_t *packet_body, size_t body_len,
264 openpgp_secret_key_t *seckey);
265
282asciichat_error_t openpgp_extract_ed25519_from_mpi(const uint8_t *mpi, size_t mpi_len, uint8_t ed25519_pk[32]);
283
308asciichat_error_t openpgp_base64_decode(const char *base64, size_t base64_len, uint8_t **binary_out,
309 size_t *binary_len);
310
unsigned int uint32_t
Definition common.h:58
unsigned long long uint64_t
Definition common.h:59
unsigned char uint8_t
Definition common.h:56
asciichat_error_t openpgp_extract_ed25519_from_mpi(const uint8_t *mpi, size_t mpi_len, uint8_t ed25519_pk[32])
Extract Ed25519 public key from MPI-encoded data.
Definition openpgp.c:167
asciichat_error_t openpgp_base64_decode(const char *base64, size_t base64_len, uint8_t **binary_out, size_t *binary_len)
Decode PGP armored base64 data.
Definition openpgp.c:32
asciichat_error_t openpgp_parse_armored_pubkey(const char *armored_text, uint8_t ed25519_pk[32])
Parse PGP armored key block and extract Ed25519 public key.
Definition openpgp.c:290
asciichat_error_t openpgp_parse_packet_header(const uint8_t *data, size_t data_len, openpgp_packet_header_t *header)
Parse OpenPGP packet header.
Definition openpgp.c:70
asciichat_error_t openpgp_parse_public_key_packet(const uint8_t *packet_body, size_t body_len, openpgp_public_key_t *pubkey)
Parse OpenPGP Public Key Packet (tag 6)
Definition openpgp.c:200
asciichat_error_t openpgp_parse_armored_seckey(const char *armored_text, uint8_t ed25519_pk[32], uint8_t ed25519_sk[32])
Parse PGP armored secret key block and extract Ed25519 keypair.
Definition openpgp.c:729
asciichat_error_t openpgp_parse_secret_key_packet(const uint8_t *packet_body, size_t body_len, openpgp_secret_key_t *seckey)
Parse OpenPGP Secret Key Packet (tag 5)
Definition openpgp.c:390
asciichat_error_t
Error and exit codes - unified status values (0-255)
Definition error_codes.h:49
ClangTool/LibTooling compatibility shim for stdbool.h.
OpenPGP packet header information.
Definition openpgp.h:71
size_t header_len
Header length (bytes consumed by header)
Definition openpgp.h:74
bool new_format
True if new format, false if old format.
Definition openpgp.h:75
uint8_t tag
Packet tag (type identifier)
Definition openpgp.h:72
size_t length
Packet body length.
Definition openpgp.h:73
OpenPGP public key packet data.
Definition openpgp.h:91
uint64_t keyid
OpenPGP Key ID (last 8 bytes of fingerprint)
Definition openpgp.h:96
uint32_t created
Creation timestamp (Unix epoch)
Definition openpgp.h:93
uint8_t algorithm
Public key algorithm (22 = EdDSA)
Definition openpgp.h:94
uint8_t version
Packet version (should be 4)
Definition openpgp.h:92
OpenPGP secret key packet data.
Definition openpgp.h:112
bool is_encrypted
True if secret key material is encrypted.
Definition openpgp.h:119
uint32_t created
Creation timestamp (Unix epoch)
Definition openpgp.h:114
uint8_t algorithm
Public key algorithm (22 = EdDSA)
Definition openpgp.h:115
uint8_t version
Packet version (should be 4)
Definition openpgp.h:113
uint64_t keyid
OpenPGP Key ID (last 8 bytes of fingerprint)
Definition openpgp.h:118