Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i3YOh-0004qV-00 for pgsql-interfaces@arkaria.postgresql.org; Fri, 30 Aug 2019 04:20:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i3YNg-0004eL-Td for pgsql-interfaces@arkaria.postgresql.org; Fri, 30 Aug 2019 04:19:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i3YNg-0004bp-IG for pgsql-interfaces@lists.postgresql.org; Fri, 30 Aug 2019 04:19:24 +0000 Received: from st43p00im-ztfb10073301.me.com ([17.58.63.186]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i3YNa-0003cf-3a for pgsql-interfaces@lists.postgresql.org; Fri, 30 Aug 2019 04:19:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=1a1hai; t=1567138756; bh=KVaX0OLmoQDxrPWzH/vTFbnpvFhIpip1CuY9nXFyTZg=; h=From:Content-Type:Subject:Message-Id:Date:To; b=t8IkLvbY9sV6da8BDSntR12OMk9r4sN7aAYaDUao8oDav1FBPK0CAH85wOo4+VGeK a3MTnSKAIEC4PDnGbnFkj9HUnvZVuJAExetYOBJoXGViT/n1j5Idswf7B4TvkTolwo JV9T1yQTwlIPQCP75lctfLSYef52PPBNfDMpg67aeOIhjT04ZdcT3lijIKeKAtE24P oaxDHcc9cjxgkF5srL/K9D6UcOOE0SfUM7yqbLkRuZMo8s6qdbjIg780zLO0oMcn8T YjHcdQggMOduFFvxnHD8fNhTAZro/q9yjFcKF3S2RqLy7KNewlW7KZgnY4N09auErk E4MIXPlhRDVnQ== Received: from [10.0.1.18] (pool-100-0-27-4.bstnma.fios.verizon.net [100.0.27.4]) by st43p00im-ztfb10073301.me.com (Postfix) with ESMTPSA id D1BC2940E55 for ; Fri, 30 Aug 2019 04:19:16 +0000 (UTC) From: Dmitry Markman Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: PQconnectdbParams and encrypted password Message-Id: <67A8E555-D7C6-41D4-B4A7-0B9E2949A6FC@mac.com> Date: Fri, 30 Aug 2019 00:19:15 -0400 To: pgsql-interfaces@lists.postgresql.org X-Mailer: Apple Mail (2.3445.104.11) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-30_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=805 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1812120000 definitions=main-1908300043 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 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