Re: What libraries need to be included in C program for encrypt and decrypt functions?

From: "Owen Jacobson" <ojacobson(at)osl(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: What libraries need to be included in C program for encrypt and decrypt functions?
Date: 2005-08-16 16:25:53
Message-ID: 000101c5a27f$2d35e420$9b00015a@osl.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

As I mentioned in email, the function "encrypt" exposed by libcrypt
(the -lcrypt part of your command line) has nothing to do with the "encrypt"
function available in pgcrypto.sql, which You Cannot Call From C. You have
to embed calls to it inside an SQL query like

INSERT INTO some_table (some_col) VALUES (ENCRYPT ('Hello', 'AAAA0000',
'aes'));
-----Original Message-----
From: pgsql-sql-owner(at)postgresql(dot)org
[mailto:pgsql-sql-owner(at)postgresql(dot)org]On Behalf Of The One
Sent: Tuesday, August 16, 2005 7:00 AM
To: pgsql-sql(at)postgresql(dot)org
Subject: [SQL] What libraries need to be included in C program for encrypt
and decrypt functions?

Hi,

Can some body tell me what I need to include in the makefile for my C
program so it will call the correct encrypt/decrypt functions.

This is what I have in the makefile
testcrypto:
${CC} -o ${BIN}/testcrypto.exe
testcrypto.c -I/usr/include/postgresql/server/libpq -L/lib/postgresql -lpq -
lcrypt

I'm calling the function like this
printf("test encryption: %s", encrypt("hello", "0000BBBB", "aes");

But I'm getting too many arguments in function encrypt.

Thank you

----------------------------------------------------------------------------
--
Start your day with Yahoo! - make it your home page

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message The One 2005-08-16 19:53:51 how to do a select * and decrypt a column at the same time?
Previous Message Greg Stark 2005-08-16 14:59:28 Re: ARRAYs and INDEXes ...