libcdoc 0.5.0
libcdoc::NetworkBackend Struct Reference

#include <NetworkBackend.h>

Classes

struct  CapsuleInfo
 Capsule information returned by capsule server. More...
 
struct  ProxyCredentials
 Proxy credentials used for network access. More...
 

Public Member Functions

 NetworkBackend ()=default
 
virtual ~NetworkBackend () noexcept=default
 
 NetworkBackend (const NetworkBackend &)=delete
 
NetworkBackendoperator= (const NetworkBackend &)=delete
 
 CDOC_DISABLE_MOVE (NetworkBackend)
 
virtual std::string getLastErrorStr (result_t code) const
 Get the textual description of the last error.
 
virtual result_t sendKey (CapsuleInfo &dst, const std::string &url, const std::vector< uint8_t > &rcpt_key, const std::vector< uint8_t > &key_material, const std::string &type, uint64_t expiry_ts)
 send key material to keyserver
 
virtual result_t fetchKey (std::vector< uint8_t > &dst, const std::string &url, const std::string &transaction_id)
 fetch key material from keyserver
 
virtual result_t getClientTLSCertificate (std::vector< uint8_t > &dst)
 get client TLS certificate in der format
 
virtual result_t getPeerTLSCertificates (std::vector< std::vector< uint8_t > > &dst)
 get a list of peer TLS certificates in der format
 
virtual result_t getPeerTLSCertificates (std::vector< std::vector< uint8_t > > &dst, const std::string &url)
 get a list of peer TLS certificates in der format
 
virtual result_t getProxyCredentials (ProxyCredentials &credentials) const
 Get proxy configuration currently set.
 
virtual result_t signTLS (std::vector< uint8_t > &dst, CryptoBackend::HashAlgorithm algorithm, const std::vector< uint8_t > &digest)
 sign TLS digest with client's private key
 

Static Public Attributes

static constexpr int NETWORK_ERROR = -300
 Generic network error.
 

Constructor & Destructor Documentation

◆ NetworkBackend() [1/2]

libcdoc::NetworkBackend::NetworkBackend ( )
default

◆ ~NetworkBackend()

virtual libcdoc::NetworkBackend::~NetworkBackend ( )
virtualdefaultnoexcept

◆ NetworkBackend() [2/2]

libcdoc::NetworkBackend::NetworkBackend ( const NetworkBackend )
delete

Member Function Documentation

◆ CDOC_DISABLE_MOVE()

libcdoc::NetworkBackend::CDOC_DISABLE_MOVE ( NetworkBackend  )

◆ fetchKey()

virtual result_t libcdoc::NetworkBackend::fetchKey ( std::vector< uint8_t > &  dst,
const std::string &  url,
const std::string &  transaction_id 
)
virtual

fetch key material from keyserver

The default implementation uses internal http client, peer TLS list and client TLS certificate

Parameters
dsta destination container for key material
urlserver url
transaction_idtransaction id of capsule
Returns
error code or OK

◆ getClientTLSCertificate()

virtual result_t libcdoc::NetworkBackend::getClientTLSCertificate ( std::vector< uint8_t > &  dst)
inlinevirtual

get client TLS certificate in der format

Parameters
dsta destination container for certificate
Returns
error code or OK

References libcdoc::NOT_IMPLEMENTED.

◆ getLastErrorStr()

virtual std::string libcdoc::NetworkBackend::getLastErrorStr ( result_t  code) const
virtual

Get the textual description of the last error.

The result is undefined if the error code does not match the most recent error

Parameters
codeThe error code
Returns
std::string error description

◆ getPeerTLSCertificates() [1/2]

virtual result_t libcdoc::NetworkBackend::getPeerTLSCertificates ( std::vector< std::vector< uint8_t > > &  dst)
inlinevirtual

get a list of peer TLS certificates in der format

Parameters
dsta destination container for certificate
Returns
error code or OK

References libcdoc::NOT_IMPLEMENTED.

◆ getPeerTLSCertificates() [2/2]

virtual result_t libcdoc::NetworkBackend::getPeerTLSCertificates ( std::vector< std::vector< uint8_t > > &  dst,
const std::string &  url 
)
inlinevirtual

get a list of peer TLS certificates in der format

Parameters
dsta destination container for certificate
urlthe base url ("https://servername:port/")
Returns
error code or OK

◆ getProxyCredentials()

virtual result_t libcdoc::NetworkBackend::getProxyCredentials ( ProxyCredentials credentials) const
inlinevirtual

Get proxy configuration currently set.

Parameters
credentialsoutput for proxy credentials

References libcdoc::NOT_IMPLEMENTED.

◆ operator=()

NetworkBackend & libcdoc::NetworkBackend::operator= ( const NetworkBackend )
delete

◆ sendKey()

virtual result_t libcdoc::NetworkBackend::sendKey ( CapsuleInfo dst,
const std::string &  url,
const std::vector< uint8_t > &  rcpt_key,
const std::vector< uint8_t > &  key_material,
const std::string &  type,
uint64_t  expiry_ts 
)
virtual

send key material to keyserver

The default implementation uses internal http client and peer TLS certificate list.

Parameters
dstthe transaction id and expiry date of the capsule on server
urlserver url
rcpt_keyrecipient's public key
key_materialencrypted KEK or ECDH public Key used to derive shared secret
typealgorithm type, currently either "rsa" or "ecc_secp384r1"
expiry_tsthe requested capsule expiry timestamp, 0 - use server default
Returns
error code or OK

◆ signTLS()

virtual result_t libcdoc::NetworkBackend::signTLS ( std::vector< uint8_t > &  dst,
CryptoBackend::HashAlgorithm  algorithm,
const std::vector< uint8_t > &  digest 
)
inlinevirtual

sign TLS digest with client's private key

Parameters
dsta destination container for signature
algorithmsigning algorithm
digestdata to be signed
Returns
error code or OK

References libcdoc::NOT_IMPLEMENTED.

Member Data Documentation

◆ NETWORK_ERROR

constexpr int libcdoc::NetworkBackend::NETWORK_ERROR = -300
staticconstexpr

Generic network error.


The documentation for this struct was generated from the following file: