Skip to content

Class star::AWSV4Signer

ClassList > star > AWSV4Signer

AWS Signature Version 4 signer. More...

  • #include <stards.h>

Public Functions

Type Name
AWSV4Signer (const std::string & access_key, const std::string & secret_key, const std::string & region, const std::string & session_token="")
const std::string & getSessionToken () const
std::string signRequest (const std::string & method, const std::string & bucket, const std::string & key, const std::string & content_hash, const std::map< std::string, std::string > & headers) const
Sign an S3 request using AWS Signature Version 4.

Public Static Functions

Type Name
std::string hexEncode (const unsigned char * data, size_t len)
Convert binary data to hex string (public utility).
std::string urlEncode (const std::string & value)

Detailed Description

Implements AWS SigV4 authentication for S3 requests. Uses OpenSSL for the SHA-256 / HMAC-SHA256 primitives on native builds and mbedTLS under WebAssembly (see the s3crypto shim above). This provides authentication without requiring the full AWS SDK.

Public Functions Documentation

function AWSV4Signer

inline star::AWSV4Signer::AWSV4Signer (
    const std::string & access_key,
    const std::string & secret_key,
    const std::string & region,
    const std::string & session_token=""
) 

function getSessionToken

inline const std::string & star::AWSV4Signer::getSessionToken () const

function signRequest

Sign an S3 request using AWS Signature Version 4.

inline std::string star::AWSV4Signer::signRequest (
    const std::string & method,
    const std::string & bucket,
    const std::string & key,
    const std::string & content_hash,
    const std::map< std::string, std::string > & headers
) const

Parameters:

  • method HTTP method (GET, PUT, etc.)
  • bucket S3 bucket name
  • key S3 object key
  • content_hash SHA256 hash of request body (hex-encoded)
  • headers Request headers (must include host and x-amz-date)

Returns:

Authorization header value


Public Static Functions Documentation

function hexEncode

Convert binary data to hex string (public utility).

static inline std::string star::AWSV4Signer::hexEncode (
    const unsigned char * data,
    size_t len
) 


function urlEncode

static inline std::string star::AWSV4Signer::urlEncode (
    const std::string & value
) 


The documentation for this class was generated from the following file StarDS/include/stards.h