PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
scram.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * scram.h
4 * Interface to libpq/scram.c
5 *
6 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
8 *
9 * src/include/libpq/scram.h
10 *
11 *-------------------------------------------------------------------------
12 */
13#ifndef PG_SCRAM_H
14#define PG_SCRAM_H
15
16#include "common/cryptohash.h"
17#include "lib/stringinfo.h"
18#include "libpq/libpq-be.h"
19#include "libpq/sasl.h"
20
21/* Number of iterations when generating new secrets */
23
24/* SASL implementation callbacks */
26
27/* Routines to handle and check SCRAM-SHA-256 secret */
28extern char *pg_be_scram_build_secret(const char *password);
29extern bool parse_scram_secret(const char *secret,
30 int *iterations,
31 pg_cryptohash_type *hash_type,
32 int *key_length, char **salt,
33 uint8 *stored_key, uint8 *server_key);
34extern bool scram_verify_plain_password(const char *username,
35 const char *password, const char *secret);
36
37#endif /* PG_SCRAM_H */
#define PGDLLIMPORT
Definition: c.h:1277
uint8_t uint8
Definition: c.h:486
pg_cryptohash_type
Definition: cryptohash.h:20
static char * username
Definition: initdb.c:153
bool parse_scram_secret(const char *secret, int *iterations, pg_cryptohash_type *hash_type, int *key_length, char **salt, uint8 *stored_key, uint8 *server_key)
Definition: auth-scram.c:600
PGDLLIMPORT const pg_be_sasl_mech pg_be_scram_mech
Definition: auth-scram.c:114
PGDLLIMPORT int scram_sha_256_iterations
Definition: auth-scram.c:196
char * pg_be_scram_build_secret(const char *password)
Definition: auth-scram.c:483
bool scram_verify_plain_password(const char *username, const char *password, const char *secret)
Definition: auth-scram.c:523
static char * password
Definition: streamutil.c:52
int iterations
Definition: thread-thread.c:39