summaryrefslogtreecommitdiffstats
path: root/kbx/keybox-blob.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2004-04-26 10:09:25 +0200
committerWerner Koch <wk@gnupg.org>2004-04-26 10:09:25 +0200
commit6aaceac7fec0b98b60ab1259bda5f97465817ce6 (patch)
treeda7228afd0a40e47f7ca15ca4bacd2594979601a /kbx/keybox-blob.c
parent(oidtranstbl): New. OIDs collected from several sources. (diff)
downloadgnupg2-6aaceac7fec0b98b60ab1259bda5f97465817ce6.tar.xz
gnupg2-6aaceac7fec0b98b60ab1259bda5f97465817ce6.zip
The keybox gets now compressed after 3 hours and ephemeral
stored certificates are deleted after about a day.
Diffstat (limited to 'kbx/keybox-blob.c')
-rw-r--r--kbx/keybox-blob.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/kbx/keybox-blob.c b/kbx/keybox-blob.c
index 96595436c..48bce28e2 100644
--- a/kbx/keybox-blob.c
+++ b/kbx/keybox-blob.c
@@ -35,9 +35,11 @@ The first record of a plain KBX file has a special format:
byte reserved
byte reserved
u32 magic 'KBXf'
- byte pgp_marginals used for validity calculation of this file
- byte pgp_completes ditto.
- byte pgp_cert_depth ditto.
+ u32 reserved
+ u32 file_created_at
+ u32 last_maintenance_run
+ u32 reserved
+ u32 reserved
The OpenPGP and X.509 blob are very similiar, things which are
X.509 specific are noted like [X.509: xxx]
@@ -85,7 +87,7 @@ X.509 specific are noted like [X.509: xxx]
u8 assigned ownertrust [X509: not used]
u8 all_validity
OpenPGP: see ../g10/trustdb/TRUST_* [not yet used]
- X509: Bit 4 set := key has been revoked. nOte that this value
+ X509: Bit 4 set := key has been revoked. Note that this value
matches TRUST_FLAG_REVOKED
u16 reserved
u32 recheck_after
@@ -978,6 +980,7 @@ _keybox_new_blob (KEYBOXBLOB *r_blob, char *image, size_t imagelen, off_t off)
return 0;
}
+
void
_keybox_release_blob (KEYBOXBLOB blob)
{
@@ -1010,3 +1013,19 @@ _keybox_get_blob_fileoffset (KEYBOXBLOB blob)
return blob->fileoffset;
}
+
+
+void
+_keybox_update_header_blob (KEYBOXBLOB blob)
+{
+ if (blob->bloblen >= 32 && blob->blob[4] == BLOBTYPE_HEADER)
+ {
+ u32 val = make_timestamp ();
+
+ /* Update the last maintenance run times tamp. */
+ blob->blob[20] = (val >> 24);
+ blob->blob[20+1] = (val >> 16);
+ blob->blob[20+2] = (val >> 8);
+ blob->blob[20+3] = (val );
+ }
+}