Re: Problem with encode () and hmac() in pgcrypto

From: Marko Kreen <markokr(at)gmail(dot)com>
To: hlcborg <h(dot)luis(dot)cardoso(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with encode () and hmac() in pgcrypto
Date: 2011-02-01 21:08:41
Message-ID: AANLkTikJdpiv9GDcS_9sXhTE=ZMxfvWV4BzxCKDcQ0MQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Feb 1, 2011 at 5:36 PM, hlcborg <h(dot)luis(dot)cardoso(at)gmail(dot)com> wrote:
> encode(hmac(v_em_crt_conc, v_Private,'sha1'),'base64');

HMAC - key-dependant SHA1

> The Result:
>
> h6CpmrP1QCE/Mp3xn3utUEPtftg=      This hash has 28 chars
>
> When I use OpenSSL in command line like this:
>
> ~$ echo "2011-01-31;2011-02-01T13:33:38;100036;684.40; " | openssl dgst
> -sha1 -sign abc.pem | openssl enc -base64 -A

Plain SHA1, which is signed with RSA signature.

> The Result is:
>
> nKfxnt31+kk/RnKihJ0jKufq+nZvmPjVauGo8+tqJ1Y/ah/mAu4jSS1wnzU+wRygZ4CLIV9DGSs9bxBc4r9e71C8s9B5ms6Kpggmc12kdmqVHBRO28bPWb/YLCej59gZFFkvcCudweNAT4qHvVqWsOtFCf9kE4q92UIv1JcwSDU=
>
> This hash has 172 chars
>
> Does someone know where is my problem? Is there other way to implement?  or
> is it simply impossible??

These two operations are not equivalent.

--
marko

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2011-02-01 21:12:32 Re: cast problem in Postgresql 9.0.1
Previous Message Adrian Klaver 2011-02-01 21:05:29 Re: Some Problems - Shall I reinstall the DB?