kee

Offline IOU signer with QR as transport
git clone https://holbrook.no/src/kee
Info | Log | Files | Refs | README | LICENSE

commit 25b99ae4188cf7105fcb5818408cd3cceb7aba51
parent b03e334f06f39ccc6c25ca001dee72747e6b4c7d
Author: lash <dev@holbrook.no>
Date:   Wed, 17 Apr 2024 18:40:09 +0100

Add signature to testdata

Diffstat:
Msrc/asn1/schema_entry.txt | 15+++++++++------
Msrc/gtk/kee-entry.c | 21+++++++++++----------
2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/src/asn1/schema_entry.txt b/src/asn1/schema_entry.txt @@ -7,18 +7,21 @@ Kee DEFINITIONS EXPLICIT TAGS ::= BEGIN body OCTET STRING } - KeeEntryFlags ::= BIT STRING { - byteorder(0), - bob-is-signer(1) - } +--- KeeEntryFlags ::= BIT STRING { +--- byteorder(0), +--- bob-is-signer(1) +--- } KeeEntry ::= SEQUENCE { - flags KeeEntryFlags, +--- flags KeeEntryFlags, parent OCTET STRING, --- timestamp GeneralizedTime, timestamp INTEGER, creditDelta INTEGER, collateralDelta INTEGER, - body OCTET STRING + body OCTET STRING, + signatureRequest OCTET STRING, + response BOOLEAN, + signatureResponse OCTET STRING } END diff --git a/src/gtk/kee-entry.c b/src/gtk/kee-entry.c @@ -115,7 +115,7 @@ static int kee_entry_deserialize_item(KeeEntry *o, const char *data, size_t data int credit; int collateral; int c; - char flags; + char flag; int v; char *p; @@ -133,20 +133,21 @@ static int kee_entry_deserialize_item(KeeEntry *o, const char *data, size_t data return r; } - c = (int)data_len; + c = (int)data_len - 1; r = asn1_der_decoding(&item, data, c, err); if (r != ASN1_SUCCESS) { fprintf(stderr, "%s\n", err); return r; } + flag = *(data+data_len-1); - c = 1; - flags = 0; - r = asn1_read_value(item, "flags", &flags, &c); - if (r != ASN1_SUCCESS) { - fprintf(stderr, "%s\n", err); - return r; - } +// c = 1; +// flags = 0; +// r = asn1_read_value(item, "flags", &flags, &c); +// if (r != ASN1_SUCCESS) { +// fprintf(stderr, "%s\n", err); +// return r; +// } credit = 0; p = (char*)&v; @@ -180,7 +181,7 @@ static int kee_entry_deserialize_item(KeeEntry *o, const char *data, size_t data alice = 0; bob = 0; - if (flags & 0x40) { // bit string is left to right + if (flag) { // bit string is left to right bob = credit; } else { alice = credit;