Thread: 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
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@postgresql.org [mailto:pgsql-sql-owner@postgresql.org]On Behalf Of The One
Sent: Tuesday, August 16, 2005 7:00 AM
To: pgsql-sql@postgresql.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