diff options
| author | alee <alee@c9f7a03b-bd48-0410-a16d-cbbf54688b0b> | 2010-07-27 19:03:40 +0000 |
|---|---|---|
| committer | alee <alee@c9f7a03b-bd48-0410-a16d-cbbf54688b0b> | 2010-07-27 19:03:40 +0000 |
| commit | 2eb3243de06f1589991da47bfde6271e0d80abe6 (patch) | |
| tree | 8168ed24525ffd35989d54bd6dd81471d5df0b08 /pki/base/tps/src/main/ObjectSpec.cpp | |
| parent | 9f8b12b0400f654f8b3f10ddbd731735c1d45607 (diff) | |
merge 8.1 -> tip, multiple bugs (base)
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@1134 c9f7a03b-bd48-0410-a16d-cbbf54688b0b
Diffstat (limited to 'pki/base/tps/src/main/ObjectSpec.cpp')
| -rw-r--r-- | pki/base/tps/src/main/ObjectSpec.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/pki/base/tps/src/main/ObjectSpec.cpp b/pki/base/tps/src/main/ObjectSpec.cpp index b53ced3ad..2896a85f0 100644 --- a/pki/base/tps/src/main/ObjectSpec.cpp +++ b/pki/base/tps/src/main/ObjectSpec.cpp @@ -244,6 +244,16 @@ void ObjectSpec::ParseAttributes(char *objectID, ObjectSpec *ObjectSpec, Buffer curpos += 4 + 2 + attribute_size; } + //Here the objectID fixed attribute gets massaged. Here's how: + // The objectID becomes the cert container id, ex: 01 + // Each key pair associated with the cert must have the same ID. + // This is done by math using the following formula: + // Given a cert id of "2", the keyAttrIds of the keys are originally + // configured as k4 and k5. Note that one is twice the cert id, and + // the other is twice the cert id plus 1. In order to map the key ids + // down to the cert's id, the code below changes both "4" and "5" back + // to "2". + int val = (objectID[1] - '0'); switch (objectID[0]) { case 'c': @@ -361,12 +371,17 @@ ObjectSpec *ObjectSpec::Parse(Buffer *b, int offset, int *nread) { int sum = 0; + + if((b->size() - offset) < 10) + return NULL; + ObjectSpec *o = new ObjectSpec(); unsigned long id = (((unsigned char *)*b)[offset + 0] << 24) + (((unsigned char *)*b)[offset + 1] << 16) + (((unsigned char *)*b)[offset + 2] << 8) + (((unsigned char *)*b)[offset + 3]); + o->SetObjectID(id); unsigned long attribute = (((unsigned char *)*b)[offset + 4] << 24) + |
