PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
crypt.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * crypt.h
4  * Interface to libpq/crypt.c
5  *
6  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * src/include/libpq/crypt.h
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef PG_CRYPT_H
14 #define PG_CRYPT_H
15 
16 #include "datatype/timestamp.h"
17 
18 /*
19  * Types of password hashes or verifiers.
20  *
21  * Plaintext passwords can be passed in by the user, in a CREATE/ALTER USER
22  * command. They will be encrypted to MD5 or SCRAM-SHA-256 format, before
23  * storing on-disk, so only MD5 and SCRAM-SHA-256 passwords should appear
24  * in pg_authid.rolpassword. They are also the allowed values for the
25  * password_encryption GUC.
26  */
27 typedef enum PasswordType
28 {
32 } PasswordType;
33 
34 extern PasswordType get_password_type(const char *shadow_pass);
35 extern char *encrypt_password(PasswordType target_type, const char *role,
36  const char *password);
37 
38 extern char *get_role_password(const char *role, char **logdetail);
39 
40 extern int md5_crypt_verify(const char *role, const char *shadow_pass,
41  const char *client_pass, const char *md5_salt,
42  int md5_salt_len, char **logdetail);
43 extern int plain_crypt_verify(const char *role, const char *shadow_pass,
44  const char *client_pass, char **logdetail);
45 
46 #endif
static char password[100]
Definition: streamutil.c:42
int plain_crypt_verify(const char *role, const char *shadow_pass, const char *client_pass, char **logdetail)
Definition: crypt.c:216
char * get_role_password(const char *role, char **logdetail)
Definition: crypt.c:39
PasswordType get_password_type(const char *shadow_pass)
Definition: crypt.c:91
int md5_crypt_verify(const char *role, const char *shadow_pass, const char *client_pass, const char *md5_salt, int md5_salt_len, char **logdetail)
Definition: crypt.c:160
PasswordType
Definition: crypt.h:27
char * encrypt_password(PasswordType target_type, const char *role, const char *password)
Definition: crypt.c:108