xref: /iperf/src/iperf_auth.h (revision bd143779)
1a51045deSralcini /*
2a51045deSralcini  * iperf, Copyright (c) 2014-2017, The Regents of the University of
3a51045deSralcini  * California, through Lawrence Berkeley National Laboratory (subject
4a51045deSralcini  * to receipt of any required approvals from the U.S. Dept. of
5a51045deSralcini  * Energy).  All rights reserved.
6a51045deSralcini  *
7a51045deSralcini  * If you have questions about your rights to use or distribute this
8a51045deSralcini  * software, please contact Berkeley Lab's Technology Transfer
9a51045deSralcini  * Department at [email protected].
10a51045deSralcini  *
11a51045deSralcini  * NOTICE.  This software is owned by the U.S. Department of Energy.
12a51045deSralcini  * As such, the U.S. Government has been granted for itself and others
13a51045deSralcini  * acting on its behalf a paid-up, nonexclusive, irrevocable,
14a51045deSralcini  * worldwide license in the Software to reproduce, prepare derivative
15a51045deSralcini  * works, and perform publicly and display publicly.  Beginning five
16a51045deSralcini  * (5) years after the date permission to assert copyright is obtained
17a51045deSralcini  * from the U.S. Department of Energy, and subject to any subsequent
18a51045deSralcini  * five (5) year renewals, the U.S. Government is granted for itself
19a51045deSralcini  * and others acting on its behalf a paid-up, nonexclusive,
20a51045deSralcini  * irrevocable, worldwide license in the Software to reproduce,
21a51045deSralcini  * prepare derivative works, distribute copies to the public, perform
22a51045deSralcini  * publicly and display publicly, and to permit others to do so.
23a51045deSralcini  *
24a51045deSralcini  * This code is distributed under a BSD style license, see the LICENSE file
25a51045deSralcini  * for complete information.
26a51045deSralcini  */
27a51045deSralcini 
28a51045deSralcini #include <time.h>
29a51045deSralcini #include <sys/types.h>
30e28f12c7Sralcini #include <openssl/bio.h>
31a51045deSralcini 
32e28f12c7Sralcini int test_load_pubkey_from_file(const char *public_keyfile);
33e28f12c7Sralcini int test_load_private_key_from_file(const char *private_keyfile);
34e28f12c7Sralcini EVP_PKEY *load_pubkey_from_file(const char *file);
35e28f12c7Sralcini EVP_PKEY *load_pubkey_from_base64(const char *buffer);
36e28f12c7Sralcini EVP_PKEY *load_privkey_from_file(const char *file);
3722da02dcSAllen Flickinger EVP_PKEY *load_privkey_from_base64(const char *buffer);
38e28f12c7Sralcini int encode_auth_setting(const char *username, const char *password, EVP_PKEY *public_key, char **authtoken);
39e28f12c7Sralcini int decode_auth_setting(int enable_debug, const char *authtoken, EVP_PKEY *private_key, char **username, char **password, time_t *ts);
40*bd143779Sralcini int check_authentication(const char *username, const char *password, const time_t ts, const char *filename, int skew_threshold);
41a51045deSralcini ssize_t iperf_getpass (char **lineptr, size_t *n, FILE *stream);
42