check_chapmd5_password
pg_check_chap_md5 · Function for verifying CHAP-MD5 authentication responses.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100176 | check_chapmd5_password | pg_check_chap_md5 | 0.0.1 | SEC | Apache-2.0 | C |
Usage
Sources:
- Official README
- Version 0.0.1 extension SQL
- C implementation
- RFC 1994: PPP Challenge Handshake Authentication Protocol
check_chapmd5_password verifies an RFC 1994 CHAP-MD5 response against a challenge and a cleartext secret. The package is named pg_check_chap_md5, but the canonical PostgreSQL extension and SQL function are both named check_chapmd5_password.
Core Workflow
The first argument is the hexadecimal CHAP response, including its one-byte identifier; the second is the hexadecimal challenge; the third is the cleartext shared secret. The function returns true when the response matches and false otherwise.
Object Index
check_chapmd5_password(chap_password text, chap_challenge text, clear_password text) RETURNS booleanperforms the verification.
Operational Notes
Version 0.0.1 is relocatable and declares no extension dependency or preload requirement. The function is STRICT and IMMUTABLE.
Treat the third argument as a credential: restrict EXECUTE, avoid exposing calls through query text or monitoring, and do not enable DEBUG2 logging because the implementation logs the cleartext password at that level. Inputs are decoded by a permissive hexadecimal parser; malformed characters produce warnings rather than robust validation. Validate response length, even-length hexadecimal encoding, and challenge size before calling the function. CHAP-MD5 itself is a legacy protocol and does not replace transport security or modern password storage.