plugin  2.1.3
Runtime plugin loader and Ed25519 DSO signing for C++ applications
fedem::sign Namespace Reference

Classes

struct  ManifestData
 
struct  ManifestResult
 
class  Manifest
 
struct  VerifyResult
 
class  Verifier
 

Enumerations

enum class  TrustLevel { TRUSTED , UNKNOWN , UNSIGNED , REJECTED }
 

Functions

const char * trustLevelName (TrustLevel t) noexcept
 
bool isSignatureValid (TrustLevel t) noexcept
 
static std::string hexEncode (const unsigned char *data, std::size_t len)
 
static std::string sha256File (std::string const &path)
 
static std::string pubKeyFingerprint (EVP_PKEY *pkey)
 
static std::string makeStrippedCopy (std::string const &soPath)
 
static EVP_PKEY * findTrustedKey (std::string const &keysDir, std::string const &keyId)
 
static bool verifySignature (EVP_PKEY *pkey, std::string const &json, std::array< uint8_t, 64 > const &sig)
 

Variables

constexpr std::size_t ED25519_SIG_BYTES = 64
 
constexpr char const * kManifestSection = ".dso_manifest"
 
constexpr char const * kSigSection = ".dso_sig"
 

Enumeration Type Documentation

◆ TrustLevel

Enumerator
TRUSTED 

Valid signature; signer key found in trusted-keys directory.

UNKNOWN 

Valid signature; signer key NOT in trusted-keys directory.

UNSIGNED 

No manifest or signature sections present in the DSO.

REJECTED 

Signature present but cryptographically invalid, or SHA-256 of the DSO does not match the manifest

Function Documentation

◆ trustLevelName()

const char* fedem::sign::trustLevelName ( TrustLevel  t)
inlinenoexcept

References REJECTED, TRUSTED, UNKNOWN, and UNSIGNED.

Referenced by main().

+ Here is the caller graph for this function:

◆ isSignatureValid()

bool fedem::sign::isSignatureValid ( TrustLevel  t)
inlinenoexcept

References TRUSTED, and UNKNOWN.

◆ hexEncode()

static std::string fedem::sign::hexEncode ( const unsigned char *  data,
std::size_t  len 
)
static

Referenced by pubKeyFingerprint(), pubKeyFingerprint(), sha256File(), and sha256File().

+ Here is the caller graph for this function:

◆ sha256File()

static std::string fedem::sign::sha256File ( std::string const &  path)
static

References hexEncode().

Referenced by main(), and fedem::sign::Verifier::verifyUncached().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pubKeyFingerprint()

static std::string fedem::sign::pubKeyFingerprint ( EVP_PKEY *  pkey)
static

References hexEncode().

Referenced by findTrustedKey(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeStrippedCopy()

static std::string fedem::sign::makeStrippedCopy ( std::string const &  soPath)
static

References kManifestSection, and kSigSection.

Referenced by fedem::sign::Verifier::verifyUncached().

+ Here is the caller graph for this function:

◆ findTrustedKey()

static EVP_PKEY* fedem::sign::findTrustedKey ( std::string const &  keysDir,
std::string const &  keyId 
)
static

References pubKeyFingerprint().

Referenced by fedem::sign::Verifier::verifyUncached().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ verifySignature()

static bool fedem::sign::verifySignature ( EVP_PKEY *  pkey,
std::string const &  json,
std::array< uint8_t, 64 > const &  sig 
)
static

References ED25519_SIG_BYTES.

Referenced by fedem::sign::Verifier::verifyUncached().

+ Here is the caller graph for this function:

Variable Documentation

◆ ED25519_SIG_BYTES

constexpr std::size_t fedem::sign::ED25519_SIG_BYTES = 64
inlineconstexpr

◆ kManifestSection

constexpr char const* fedem::sign::kManifestSection = ".dso_manifest"
inlineconstexpr

◆ kSigSection

constexpr char const* fedem::sign::kSigSection = ".dso_sig"
inlineconstexpr