10Duke Enterprise C++ SDK
Loading...
Searching...
No Matches
tenduke::jwk::JWK Class Reference

#include <JWK.h>

Detailed Description

Describes a JWK, Json Web Key.

IMPLEMENTATION NOTE: This currently only supports tenduke::crypto:PublicKey's. IMPLEMENTATION NOTE: Only subset of attributes / key types are supported.

Public Member Functions

 JWK (std::string id, std::string type, const std::shared_ptr< const tenduke::crypto::PublicKey > &key, std::string use="", std::string alg="")
 Constructs new instance.
bool isUsableForSignature (::tenduke::crypto::HashAlgorithm algorithm) const
 Checks if the key can be used to verify signatures made with given algorithm: The key must not be meant for other use than signatures (use), and if the key specifies an algorithm (alg), it must match.

Static Public Member Functions

::tenduke::crypto::HashAlgorithm mapFromJWTAlgorithm (const std::string &jwtAlgorithm)
 Maps JSON Web Token algorithm (alg) to Algorithm.

Public Attributes

const std::string id
 Id of the key, JWK property "kid".
const std::string type
 Type of the key, JWK property "kty".
const std::shared_ptr< const tenduke::crypto::PublicKey > key
 Parsed key representation.
const std::string use
 Intended use of the key, JWK property "use".
const std::string alg
 Algorithm intended for use with the key, JWK property "alg".

Constructor & Destructor Documentation

◆ JWK()

tenduke::jwk::JWK::JWK ( std::string id,
std::string type,
const std::shared_ptr< const tenduke::crypto::PublicKey > & key,
std::string use = "",
std::string alg = "" )

Constructs new instance.

Parameters
idid of the JWK (kid property)
typetype of the JWK (kty property, but this is not enough to describe all keys)
keythe actual crypto graphic key
useintended use of the key (use property, e.g. sig or enc). Empty if not specified.
algalgorithm intended for use with the key (alg property, e.g. RS256). Empty if not specified.

Member Function Documentation

◆ isUsableForSignature()

bool tenduke::jwk::JWK::isUsableForSignature ( ::tenduke::crypto::HashAlgorithm algorithm) const

Checks if the key can be used to verify signatures made with given algorithm: The key must not be meant for other use than signatures (use), and if the key specifies an algorithm (alg), it must match.

Parameters
algorithmthe signature algorithm. If NONE, only use is checked.
Returns
-

◆ mapFromJWTAlgorithm()

HashAlgorithm tenduke::jwk::JWK::mapFromJWTAlgorithm ( const std::string & jwtAlgorithm)
static

Maps JSON Web Token algorithm (alg) to Algorithm.

TODO: Is this in correct place?

Parameters
jwtAlgorithm-
Returns
-

Member Data Documentation

◆ alg

const std::string tenduke::jwk::JWK::alg

Algorithm intended for use with the key, JWK property "alg".

Empty if not specified.

◆ use

const std::string tenduke::jwk::JWK::use

Intended use of the key, JWK property "use".

Empty if not specified.


The documentation for this class was generated from the following files:
  • core/core/src/jwk/JWK.h
  • core/core/src/jwk/JWK.cpp