Skip to main content

HMAC

Those basic cryptography operations allow the calculation and verify HMAC messages.

Allowed usersUser✓Master✗ExtAuth✓
Required access scopekeymgmt:use:<KID>

where <KID> is a Key ID as a 32-character hexadecimal string

Hash​

Gen an HMAC of a message​

POSThttps://my.ence.do/api/crypto/hmac/hash

Return an HMAC of a given message.

Headers​

NameTypeDescription
Authorization*StringBearer JWT_TOKEN
Content-Type*Stringapplication/json

Request Body​

NameTypeDescription
algStringAlgorithm to use (e.g. SHA2-256)
ext_kidStringExternal Key ID, 32 chars hex string
msg*StringBase64 encoded message to hmac (max. 2048 bytes)
pubkeyStringBase64 encoded external public key
kid*StringKey ID, 32 chars hex string

Response status code​

{
"mac": "otGuoI+uH8K6cWk6Qnx3vNGKDjFv2zTF0dUM73a3YMo="
}
info

The key type pointed to ext_kid or represented by pubkey MUST be the same as the kid key type. Otherwise, indirect ECDH will fail.

Possible alg values​

AgorithmDescription
SHA2-256SHA2-256 HMAC
SHA2-384SHA2-384 HMAC
SHA2-512SHA2-512 HMAC
SHA3-256SHA3-256 HMAC
SHA3-384SHA3-384 HMAC
SHA3-512SHA3-512 HMAC

Response data for successful operation​

NameTypeDescription
macStringBase64 encoded HMAC value

Log entries​

EventResultSource
LOG_TYPE_FAILED_SCOPE_CHECKLOG_RESULT_FAILED403
LOG_TYPE_CRYPTO_HMAC_HASHLOG_RESULT_ERROR400
LOG_TYPE_CRYPTO_HMAC_HASHLOG_RESULT_FAILED406
LOG_TYPE_CRYPTO_HMAC_HASHLOG_RESULT_OK200

Verify​

Verify an HMAC of the message​

POSThttps://my.ence.do/api/crypto/hmac/verify

Verify the hash of a given message.

Headers​

NameTypeDescription
Authorization*StringBearer JWT_TOKEN
Content-Type*Stringapplication/json

Request Body​

NameTypeDescription
algStringAlgorithm to use (e.g. SHA2-256)
ext_kidStringExternal Key ID, 32 chars hex string
mac*StringMAC calculated by hash operation
msg*StringBase64 encoded HMAC of a message to validate (max. 2048 bytes)
pubkeyStringBase64 encoded external public key
kid*StringKey ID, 32 chars hex string

Response status code​

No response body.

info

The key type pointed to ext_kid or represented by pubkey MUST be the same as the kid key type. Otherwise, indirect ECDH will fail.

Possible alg values​

Check the list here.

Log entries​

EventResultSource
LOG_TYPE_FAILED_SCOPE_CHECKLOG_RESULT_FAILED403
LOG_TYPE_CRYPTO_HMAC_HASHLOG_RESULT_ERROR400
LOG_TYPE_CRYPTO_HMAC_HASHLOG_RESULT_FAILED406
LOG_TYPE_CRYPTO_HMAC_HASHLOG_RESULT_OK200