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