Skip to main content

ECDH

This basic cryptography operation allows the calculation of the ECDH between a trusted key or by an external public key.

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

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

Generate ECDH​

POSThttps://my.ence.do/api/crypto/ecdh

Return raw or hashed ECDH results between given arguments.

Headers​

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

Request Body​

NameTypeDescription
algStringAlgorithm used to hash the result (e.g. SHA2-256) - if omitted, raw ECDH is returned
kid*StringKey ID, 32-character hex string
pubkeyStringBase64 encoded external public key
ext_kidStringExternal Key ID, 32-character hex string

Response status code​

{
"ecdh": "AZlsNHaUXGNaPMUg139TwnW5QB7WvVKAMEFnHF3JT122JTTnCHuZ1Z6sc2Hvz3WETWJ0ePKUVRJ5HzxDQ4IzdV=="
}
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​

ValueDescription
SHA2-256Use SHA2-256 to hash the ECDH result
SHA2-384Use SHA2-384 to hash the ECDH result
SHA2-512Use SHA2-512 to hash the ECDH result
SHA3-256Use SHA3-256 to hash the ECDH result
SHA3-384Use SHA3-384 to hash the ECDH result
SHA3-512Use SHA3-512 to hash the ECDH result

Response data for successful operation​

NameTypeDescription
ecdhStringBase64 encoded the ECDH result

Log entries​

EventResultSource
LOG_TYPE_FAILED_SCOPE_CHECKLOG_RESULT_FAILED403
LOG_TYPE_CRYPTO_ECDHLOG_RESULT_ERROR400
LOG_TYPE_CRYPTO_ECDHLOG_RESULT_FAILED406
LOG_TYPE_CRYPTO_ECDHLOG_RESULT_OK200