PQconnectdbParams and encrypted password

Dmitry Markman <[email protected]> Fri, 30 Aug 2019 00:19:15 -0400
Newsgroups gmane.comp.db.postgresql.interfaces
Message-ID <[email protected]>
Hi
I need some help with setting PQconnectdbParams key/value for encrypted =
password

suppose I created user with the string

create user foobar with encrypted password =
=E2=80=98md5f3c33545d22dbf811737afb8d0e85597=E2=80=99

I was able to connect successfully using=20

psql -U foobar

I guess my pg_hba.conf is OK:

local   all             foobar                                    md5
host    all             foobar              127.0.0.1/32          md5
host    all             foobar              0.0.0.0/0             md5

however

I have a problem to connect to the server from my C++ program using =
PQconnectdbParams function

            const std::pair<std::string, std::string> connParams[] =3D {
                {"host", =E2=80=9Clocalhost"},
                {"port", ""},
                {"user", =E2=80=9Cfoobar"},
                {"password", ??????????????},//I=E2=80=99d like to have =
here =E2=80=9Cmd5f3c33545d22dbf811737afb8d0e85597=E2=80=9D, but it =
doesn=E2=80=99t work
                {"options","password_encryption=3D'md5'"},
                {"dbname", "test_db"},
                {"connect_timeout", =E2=80=9C10"}=20
            };
            const char* keywords[] =3D {connParams[0].first.c_str(),
                                      connParams[1].first.c_str(),
                                      connParams[2].first.c_str(),
                                      connParams[3].first.c_str(),
                                      connParams[4].first.c_str(),
                                      connParams[5].first.c_str(),
                                      connParams[6].first.c_str(),
                                      nullptr};
            const char* connValues[] =3D {connParams[0].second.c_str(),
                                        connParams[1].second.c_str(),
                                        connParams[2].second.c_str(),
                                        connParams[3].second.c_str(),
                                        connParams[4].second.c_str(),
                                        connParams[5].second.c_str(),
                                        connParams[6].second.c_str(),
                                        nullptr};

		auto db =3D PQconnectdbParams(keywords, connValues)


whatever I tried ConnStatusType of the db is CONNECTION_BAD

if I use value as =E2=80=9Copen=E2=80=9D string for the =
key=3D=E2=80=9Cpassword=E2=80=9D, then connection was successful


thanks in advance

dm