-
Notifications
You must be signed in to change notification settings - Fork 0
/
crypt.h
46 lines (36 loc) · 1.31 KB
/
crypt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* crypt.h -- crypto interface
*
* Copyright Dean Scarff
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License.
*/
#ifndef CRYPT_H
#define CRYPT_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
/* Initialise the cryptography module. */
void crypt_init();
/* Cleanup the cryptography module. */
void crypt_finish();
/* Load a dnssec-keygen(8) RSA private key (format 1.2) from the
* stream `privkey'. This key will be used for subsequent signing
* operations. `crypt_init' must be called before this function. */
void crypt_load_key(FILE *privkey);
/* Return the key footprint, in host byte-order. The key footprint is
* defined in RFC2535 4.1.6 as "the most significant 16 of the least
* significant 24 bits". */
uint16_t crypt_footprint();
/* Return the number of octets required for the signature generated by
* `crypt_sign'. */
size_t crypt_sign_length();
/* Write a binary signature for the data of `length' octets starting
* at `src' to `dst'. There must be space for `crypt_sign(src,
* length)' octets from `dst'. Returns the first octet after the
* written signature. */
char *crypt_sign(char *dst, const char *src, size_t length);
#endif /* defined(CRYPT_H) */