~ubuntu-branches/ubuntu/lucid/postgresql-8.4/lucid-security

« back to all changes in this revision

Viewing changes to contrib/pgcrypto/sql/pgp-pubkey-encrypt.sql

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-03-20 12:00:13 UTC
  • Revision ID: james.westby@ubuntu.com-20090320120013-hogj7egc5mjncc5g
Tags: upstream-8.4~0cvs20090328
ImportĀ upstreamĀ versionĀ 8.4~0cvs20090328

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--
 
2
-- PGP Public Key Encryption
 
3
--
 
4
 
 
5
-- successful encrypt/decrypt
 
6
select pgp_pub_decrypt(
 
7
        pgp_pub_encrypt('Secret msg', dearmor(pubkey)),
 
8
        dearmor(seckey))
 
9
from keytbl where keytbl.id=1;
 
10
 
 
11
select pgp_pub_decrypt(
 
12
                pgp_pub_encrypt('Secret msg', dearmor(pubkey)),
 
13
                dearmor(seckey))
 
14
from keytbl where keytbl.id=2;
 
15
 
 
16
select pgp_pub_decrypt(
 
17
                pgp_pub_encrypt('Secret msg', dearmor(pubkey)),
 
18
                dearmor(seckey))
 
19
from keytbl where keytbl.id=3;
 
20
 
 
21
select pgp_pub_decrypt(
 
22
                pgp_pub_encrypt('Secret msg', dearmor(pubkey)),
 
23
                dearmor(seckey))
 
24
from keytbl where keytbl.id=6;
 
25
 
 
26
-- try with rsa-sign only
 
27
select pgp_pub_decrypt(
 
28
                pgp_pub_encrypt('Secret msg', dearmor(pubkey)),
 
29
                dearmor(seckey))
 
30
from keytbl where keytbl.id=4;
 
31
 
 
32
-- try with secret key
 
33
select pgp_pub_decrypt(
 
34
                pgp_pub_encrypt('Secret msg', dearmor(seckey)),
 
35
                dearmor(seckey))
 
36
from keytbl where keytbl.id=1;
 
37
 
 
38
-- does text-to-bytea works
 
39
select pgp_pub_decrypt_bytea(
 
40
                pgp_pub_encrypt('Secret msg', dearmor(pubkey)),
 
41
                dearmor(seckey))
 
42
from keytbl where keytbl.id=1;
 
43
 
 
44
-- and bytea-to-text?
 
45
select pgp_pub_decrypt(
 
46
                pgp_pub_encrypt_bytea('Secret msg', dearmor(pubkey)),
 
47
                dearmor(seckey))
 
48
from keytbl where keytbl.id=1;
 
49
 
 
50