Обсуждение: How to encode and decode password in pgsql !!

Поиск
Список
Период
Сортировка

How to encode and decode password in pgsql !!

От
"Subhramanya Shiva"
Дата:
hi all

how to store password details in a table. in encoded form
and how to decode it.

in mysql ...we r having encoding and decoding for a password
security ... so how to do in pgsql...

regards
Shiva.

-- 
Subhramanya Shiva, Programmer
Archean InfoTech pvt.Ltd.
Hyderabad, India
http://www.archeanit.com




Re: How to encode and decode password in pgsql !!

От
darcy@druid.net (D'Arcy J.M. Cain)
Дата:
Thus spake Subhramanya Shiva
> how to store password details in a table. in encoded form
> and how to decode it.
> 
> in mysql ...we r having encoding and decoding for a password
> security ... so how to do in pgsql...

You use the chkpass type that I just commited to the distribution (finally.)
Here is an example of its usage.

darcy=# CREATE TABLE x (i serial, p chkpass);
NOTICE:  CREATE TABLE will create implicit sequence 'x_i_seq' for SERIAL column 'x.i'
NOTICE:  CREATE TABLE/UNIQUE will create implicit index 'x_i_key' for table 'x'
CREATE
darcy=# INSERT INTO x (p) VALUES ('hello');
INSERT 805247 1
darcy=# INSERT INTO x (p) VALUES ('goodbye');
INSERT 805248 1
darcy=# SELECT * FROM x;i |       p        
---+----------------1 | :SoLA2YFpQYV/I2 | :Sg8CKkFqqTGec
(2 rows)

darcy=# SELECT p = 'hello' FROM x WHERE i = 1;?column? 
----------t
(1 row)

darcy=# SELECT p = 'hello' FROM x WHERE i = 2;?column? 
----------f
(1 row)

darcy=# SELECT i, raw(p) FROM x;i |      raw      
---+---------------1 | SoLA2YFpQYV/I2 | Sg8CKkFqqTGec
(2 rows)

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.


Re: How to encode and decode password in pgsql !!

От
"Josh Berkus"
Дата:
D'Arcy,

> You use the chkpass type that I just commited to the distribution
> (finally.)
> Here is an example of its usage.

Does that mean that chkpass is part of 7.1, or only  the current CVS?
                -Josh

______AGLIO DATABASE SOLUTIONS___________________________                                      Josh Berkus Complete
informationtechnology      josh@agliodbs.com  and data management solutions       (415) 565-7293 for law firms, small
businesses       fax 621-2533   and non-profit organizations.      San Francisco
 


Re: How to encode and decode password in pgsql !!

От
Tom Lane
Дата:
"Josh Berkus" <josh@agliodbs.com> writes:
>> You use the chkpass type that I just commited to the distribution

> Does that mean that chkpass is part of 7.1, or only  the current CVS?

Unless someone rips it out again, it will be part of 7.1.1.

I think D'Arcy acted inappropriately in committing a new-feature item
before we'd made the branch for 7.2 development.  But I don't have the
time to argue about it...
        regards, tom lane


Re: How to encode and decode password in pgsql !!

От
Bruce Momjian
Дата:
[ Charset ISO-8859-1 unsupported, converting... ]
> D'Arcy,
> 
> > You use the chkpass type that I just commited to the distribution
> > (finally.)
> > Here is an example of its usage.
> 
> Does that mean that chkpass is part of 7.1, or only  the current CVS?
> 

It will appear in 7.1.1, to be released soon.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: How to encode and decode password in pgsql !!

От
Roberto Mello
Дата:
On Wed, May 02, 2001 at 01:07:57AM +0530, Subhramanya Shiva wrote:
> hi all
> 
> how to store password details in a table. in encoded form
> and how to decode it.
> 
> in mysql ...we r having encoding and decoding for a password
> security ... so how to do in pgsql...
I usually do the encrypting in the client application (AOLserver, PHP),
store the encrypted password, when the user comes back and enters the
password I encrypt it and test it against what's on the database.
-Roberto
-- 
+----| http://fslc.usu.edu USU Free Software & GNU/Linux Club |------+ Roberto Mello - Computer Science, USU -
http://www.brasileiro.net      http://www.sdl.usu.edu - Space Dynamics Lab, Developer    
 
Thou shall not kill, unless it's for dinner!


Re: How to encode and decode password in pgsql !!

От
"Subhramanya Shiva"
Дата:
i could not find chkpass in pgsql datatypes ...
it is giving error called : 

Unable to locate type name chkpass in catalog.

what shall i do ??

regards
Shiva.

> Thus spake Subhramanya Shiva
> > how to store password details in a table. in encoded form
> > and how to decode it.
> > 
> > in mysql ...we r having encoding and decoding for a password
> > security ... so how to do in pgsql...
> 
> You use the chkpass type that I just commited to the distribution 
(finally.)
> Here is an example of its usage.
> 
> darcy=# CREATE TABLE x (i serial, p chkpass);
> NOTICE:  CREATE TABLE will create implicit sequence 'x_i_seq' for SERIAL 
column 'x.i'
> NOTICE:  CREATE TABLE/UNIQUE will create implicit index 'x_i_key' for 
table 'x'
> CREATE
> darcy=# INSERT INTO x (p) VALUES ('hello');
> INSERT 805247 1
> darcy=# INSERT INTO x (p) VALUES ('goodbye');
> INSERT 805248 1
> darcy=# SELECT * FROM x;
>  i |       p        
> ---+----------------
>  1 | :SoLA2YFpQYV/I
>  2 | :Sg8CKkFqqTGec
> (2 rows)
> 
> darcy=# SELECT p = 'hello' FROM x WHERE i = 1;
>  ?column? 
> ----------
>  t
> (1 row)
> 
> darcy=# SELECT p = 'hello' FROM x WHERE i = 2;
>  ?column? 
> ----------
>  f
> (1 row)
> 
> darcy=# SELECT i, raw(p) FROM x;
>  i |      raw      
> ---+---------------
>  1 | SoLA2YFpQYV/I
>  2 | Sg8CKkFqqTGec
> (2 rows)
> 
> -- 
> D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
> http://www.druid.net/darcy/                |  and a sheep voting on
> +1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.
> 


-- 
Subhramanya Shiva, Programmer
Archean InfoTech pvt.Ltd.
Hyderabad, India
http://www.archeanit.com




Re: How to encode and decode password in pgsql !!

От
darcy@druid.net (D'Arcy J.M. Cain)
Дата:
Thus spake Subhramanya Shiva
> i could not find chkpass in pgsql datatypes ...
> it is giving error called : 
> 
> Unable to locate type name chkpass in catalog.
> 
> what shall i do ??

You need the code that I just committed.  You can get the files from
http://www.ca.postgresql.org/cgi/cvsweb.cgi/pgsql/contrib/chkpass/.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.