Paraslash Audio Streaming | |
About News Download Documentation Development |
Non-public crypto interface. More...
Macros | |
#define | AES_CRT128_BLOCK_SIZE 16 |
AES block size in bytes. More... | |
#define | PKT_PEM (0) |
Legacy PEM keys (openssh-7.7 and earlier, paraslash.0.6.2 and earlier) More... | |
#define | PKT_OPENSSH (1) |
OPENSSH keys (since openssh-7.8, paraslash.0.6.3) More... | |
Functions | |
int | decode_public_key (const char *filename, unsigned char **blob, size_t *decoded_size) |
Perform sanity checks and base64-decode an ssh-rsa key. More... | |
int | decode_private_key (const char *key_file, unsigned char **result, size_t *blob_size) |
Decode an openssh-v1 (aka RFC4716) or PEM (aka ASN.1) private key. More... | |
int | check_private_key_file (const char *file) |
Check existence and permissions of a private key file. More... | |
int | find_openssh_bignum_offset (const unsigned char *data, int len) |
Check header of an openssh private key and compute bignum offset. More... | |
Non-public crypto interface.
#define AES_CRT128_BLOCK_SIZE 16 |
AES block size in bytes.
#define PKT_PEM (0) |
Legacy PEM keys (openssh-7.7 and earlier, paraslash.0.6.2 and earlier)
#define PKT_OPENSSH (1) |
OPENSSH keys (since openssh-7.8, paraslash.0.6.3)
int decode_public_key | ( | const char * | filename, |
unsigned char ** | blob, | ||
size_t * | decoded_size | ||
) |
Perform sanity checks and base64-decode an ssh-rsa key.
filename | The public key file (usually id_rsa.pub). |
blob | Pointer to base64-decoded blob is returned here. |
decoded_size | The size of the decoded blob. |
The memory pointed at by the returned blob pointer has to be freed by the caller.
References mmap_full_file().
Referenced by apc_get_pubkey().
int decode_private_key | ( | const char * | key_file, |
unsigned char ** | result, | ||
size_t * | blob_size | ||
) |
Decode an openssh-v1 (aka RFC4716) or PEM (aka ASN.1) private key.
key_file | The private key file (usually id_rsa). |
result | Pointer to base64-decoded blob is returned here. |
blob_size | The size of the decoded blob. |
This only checks header and footer and base64-decodes the part in between. No attempt to read the decoded part is made.
References alloc(), base64_decode(), mmap_full_file(), PARA_INFO_LOG, para_isspace, para_munmap(), PARA_WARNING_LOG, PKT_OPENSSH, PKT_PEM, PRIVATE_OPENSSH_KEY_FOOTER, PRIVATE_OPENSSH_KEY_HEADER, PRIVATE_PEM_KEY_FOOTER, and PRIVATE_PEM_KEY_HEADER.
int check_private_key_file | ( | const char * | file | ) |
Check existence and permissions of a private key file.
file | The path of the key file. |
This checks whether the file exists and its permissions are restrictive enough. It is considered an error if we own the file and it is readable for others.
References ERRNO_TO_PARA_ERROR.
Referenced by apc_priv_decrypt().
int find_openssh_bignum_offset | ( | const unsigned char * | data, |
int | len | ||
) |
Check header of an openssh private key and compute bignum offset.
data | The base64-decoded key. |
len | The size of the decoded key. |
Several assumptions are made about the key. Most notably, we only support single unencrypted keys without comments.