TsgcWSAPIKeyManagerMethods › KeyExists

KeyExists Method

Returns True if the key is known (active, revoked, expired or rotated).

Syntax

function KeyExists(const aKey: string): Boolean;

Parameters

NameTypeDescription
aKeyconst stringRaw plaintext key to probe (re-hashed internally).

Return Value

True whenever an entry with the matching hash exists regardless of its status (kksActive, kksRevoked, kksExpired or kksRotated). False only when the key has never been issued by this manager instance. (Boolean)

Remarks

Presence-only check — does not imply validity. Use it to distinguish "unknown key" from "known key that is currently rejected" in user-facing error messages, and for de-duplication when importing keys from another manager instance. The hash comparison is constant-time.

Example

if not sgcWSAPIKeyManager1.KeyExists(vKey) then
  ShowMessage('Unknown key — please check for typos.');

Back to Methods