Postgresql错误:腐败的ascii-armor

时间:2014-12-01 13:11:07

标签: postgresql postgresql-9.3 pgcrypto

我正在使用 PostgreSQL 9.3.5  并尝试使用pgp_pub_encrypt()扩展程序提供的pgcrypto加密数据。运行SELECT pgp_pub_encrypt('Vipin', dearmor('gpg_public_key'))会抛出错误 Corrupt ascii-armor 。请帮忙。

我正在使用

1 个答案:

答案 0 :(得分:2)

您应该将整个密钥放入pgp_pub_encrypt参数中,如下所示:

SELECT pgp_pub_encrypt('Vipin', dearmor('-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1

mQGiBFR8W3ERBACKsgiAj/33Nun49c811V690UENs+2Fv/19izsJZfltcaex5iEK
DaBqPEHh98ebv1eeTC5ebw8VL/bgNbg4IBFd4QugxIy3yfO0YVYGHSHRTlrs5zkq
VybfvpbQjoeRUsuDkr0vHsoq1Qdrj5ujKLoTbnNHk7K5LAdatvxf1oZQ+wCg/vty
RVOHsQc+ohID22fvv8gJnxUD/RUja2u3eZicuLuADVqNbIuJzGxtY2wLbVCbKp5L
OGT2FfMr616NHbrM3Ve1Az0jhoqGB6II0piGHWzarYXZ6M1tIwMCXnDwngUtJXmX
tN9dAah5GNGnPVFb/bkIMG1YsWbZ+2WQ4w0wk1aSKIaw01eoFTyBED7CIJC32uYr
hKQfA/9mLK4stV57E85PK/9j6zUB64dg/bdzvznrt6NFH0PLYoEFYkZfK/Z+sgCR
o0jQ0UhTc66rymFbLKVLBv6FVfDxdZvKJdur55NiYFR9WC7vJyJsTgRGBKkqe5s3
g6EP+vxRkj8hPUBwuiP/hwYB0wQKwuiTsJ33BDVkjVLofoBdSbQgVmlwaW4gTmFn
cGFsIDx2aXBpbkBlcm9zbGFicy5jbz6IaAQTEQIAKAUCVHxbcQIbAwUJEswDAAYL
CQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQ3p94MRvpYrg+5gCgz5Iwn2xdbJ1A
bSZebBc/KEIIirYAnRxWDtGbXn3faoStbkKd7RJXvnNguQENBF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