Android-cuttlefish cvd tool
Functions | Variables
auth.cpp File Reference
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <map>
#include <mutex>
#include <set>
#include <string>
#include <adb/crypto/rsa_2048_key.h>
#include <adb/crypto/x509_generator.h>
#include <adb/tls/adb_ca_list.h>
#include <adb/tls/tls_connection.h>
#include <android-base/errors.h>
#include <android-base/file.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include <crypto_utils/android_pubkey.h>
#include <openssl/base64.h>
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
#include <openssl/sha.h>
#include "adb.h"
#include "adb_auth.h"
#include "adb_io.h"
#include "adb_utils.h"
#include "sysdeps.h"
#include "transport.h"
Include dependency graph for auth.cpp:

Functions

static bool generate_key (const std::string &file)
 
static std::string hash_key (RSA *key)
 
static std::shared_ptr< RSA > read_key_file (const std::string &file)
 
static bool load_key (const std::string &file)
 
static bool load_keys (const std::string &path, bool allow_dir=true)
 
std::string adb_auth_get_userkey_path ()
 
static bool load_userkey ()
 
static std::set< std::string > get_vendor_keys ()
 
std::deque< std::shared_ptr< RSA > > adb_auth_get_private_keys ()
 
static std::string adb_auth_sign (RSA *key, const char *token, size_t token_size)
 
static bool pubkey_from_privkey (std::string *out, const std::string &path)
 
bssl::UniquePtr< EVP_PKEY > adb_auth_get_user_privkey ()
 
std::string adb_auth_get_userkey ()
 
int adb_auth_keygen (const char *filename)
 
int adb_auth_pubkey (const char *filename)
 
void adb_auth_init ()
 
static void send_auth_publickey (atransport *t)
 
void send_auth_response (const char *token, size_t token_size, atransport *t)
 
void adb_auth_tls_handshake (atransport *t)
 
int adb_tls_set_certificate (SSL *ssl)
 

Variables

static std::mutex & g_keys_mutex = *new std::mutex
 
static std::map< std::string, std::shared_ptr< RSA > > & g_keys
 
static std::map< int, std::string > & g_monitored_paths = *new std::map<int, std::string>
 

Function Documentation

◆ adb_auth_get_private_keys()

std::deque< std::shared_ptr< RSA > > adb_auth_get_private_keys ( )

◆ adb_auth_get_user_privkey()

bssl::UniquePtr< EVP_PKEY > adb_auth_get_user_privkey ( )

◆ adb_auth_get_userkey()

std::string adb_auth_get_userkey ( )

◆ adb_auth_get_userkey_path()

std::string adb_auth_get_userkey_path ( )

◆ adb_auth_init()

void adb_auth_init ( )

◆ adb_auth_keygen()

int adb_auth_keygen ( const char *  filename)

◆ adb_auth_pubkey()

int adb_auth_pubkey ( const char *  filename)

◆ adb_auth_sign()

static std::string adb_auth_sign ( RSA *  key,
const char *  token,
size_t  token_size 
)
static

◆ adb_auth_tls_handshake()

void adb_auth_tls_handshake ( atransport t)

◆ adb_tls_set_certificate()

int adb_tls_set_certificate ( SSL *  ssl)

◆ generate_key()

static bool generate_key ( const std::string &  file)
static

◆ get_vendor_keys()

static std::set< std::string > get_vendor_keys ( )
static

◆ hash_key()

static std::string hash_key ( RSA *  key)
static

◆ load_key()

static bool load_key ( const std::string &  file)
static

◆ load_keys()

static bool load_keys ( const std::string &  path,
bool  allow_dir = true 
)
static

◆ load_userkey()

static bool load_userkey ( )
static

◆ pubkey_from_privkey()

static bool pubkey_from_privkey ( std::string *  out,
const std::string &  path 
)
static

◆ read_key_file()

static std::shared_ptr< RSA > read_key_file ( const std::string &  file)
static

◆ send_auth_publickey()

static void send_auth_publickey ( atransport t)
static

◆ send_auth_response()

void send_auth_response ( const char *  token,
size_t  token_size,
atransport t 
)

Variable Documentation

◆ g_keys

std::map<std::string, std::shared_ptr<RSA> >& g_keys
static
Initial value:
=
*new std::map<std::string, std::shared_ptr<RSA>>

◆ g_keys_mutex

std::mutex& g_keys_mutex = *new std::mutex
static

◆ g_monitored_paths

std::map<int, std::string>& g_monitored_paths = *new std::map<int, std::string>
static