add dissection of the structure : Extension

svn path=/trunk/; revision=11507
This commit is contained in:
Ronnie Sahlberg 2004-07-24 22:16:41 +00:00
parent d890f4934e
commit 829a19a29b
4 changed files with 114 additions and 53 deletions

View File

@ -79,11 +79,13 @@ Extensions ::= SEQUENCE OF Extension
-- For those extensions where ordering of individual extensions within the SEQUENCE is significant, the
-- specification of those individual extensions shall include the rules for the significance of the order therein
-- XXX Implemented by hand in the template
Extension ::= SEQUENCE {
-- extnId EXTENSION.&id({ExtensionSet}),
critical BOOLEAN DEFAULT FALSE,
extnValue OCTET STRING-- contains a DER encoding of a value of type &ExtnType
-- for the extension object identified by extnId
-- critical BOOLEAN DEFAULT FALSE,
-- extnValue OCTET STRING
-- contains a DER encoding of a value of type &ExtnType
-- for the extension object identified by extnId
}
--ExtensionSet EXTENSION ::=

View File

@ -44,14 +44,58 @@
#define PFNAME "x509af"
/* Initialize the protocol and registered fields */
int proto_x509af = -1;
int hf_x509af_algorithm_id = -1;
static int proto_x509af = -1;
static int hf_x509af_algorithm_id = -1;
static int hf_x509af_extension_id = -1;
static int hf_x509af_critical = -1; /* BOOLEAN */
#include "packet-x509af-hf.c"
/* Initialize the subtree pointers */
#include "packet-x509af-ett.c"
static char extension_id[64]; /*64 chars should be long enough? */
static int
dissect_hf_x509af_extension_id(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
{
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
hf_x509af_extension_id, extension_id);
return offset;
}
/* BOOLEAN from template, remove later if the compiler starts generating it */
static int
dissect_x509af_BOOLEAN(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_boolean(pinfo, tree, tvb, offset, hf_index);
return offset;
}
static int dissect_critical(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_x509af_BOOLEAN(FALSE, tvb, offset, pinfo, tree, hf_x509af_critical);
}
static int
dissect_hf_x509af_extension_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
{
offset=call_ber_oid_callback(extension_id, tvb, offset, pinfo, tree);
return offset;
}
static ber_sequence Extension_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_hf_x509af_extension_id },
{ BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_critical },
{ BER_CLASS_ANY, 0, 0, dissect_hf_x509af_extension_type },
{ 0, 0, 0, NULL }
};
static int
dissect_x509af_Extension(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
Extension_sequence, hf_index, ett_x509af_Extension);
return offset;
}
static char algorithm_id[64]; /*64 chars should be long enough? */
static int
dissect_hf_x509af_algorithm_id(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
@ -96,6 +140,14 @@ void proto_register_x509af(void) {
{ "Algorithm Id", "x509af.algorithm.id",
FT_STRING, BASE_NONE, NULL, 0,
"Algorithm Id", HFILL }},
{ &hf_x509af_extension_id,
{ "Extension Id", "x509af.extension.id",
FT_STRING, BASE_NONE, NULL, 0,
"Extension Id", HFILL }},
{ &hf_x509af_critical,
{ "critical", "x509af.critical",
FT_BOOLEAN, 8, NULL, 0,
"Extension/critical", HFILL }},
#include "packet-x509af-hfarr.c"
};

View File

@ -22,6 +22,7 @@ AttributeCertificate
#.NO_EMIT
AlgorithmIdentifier
Extension
#.TYPE_RENAME
AttributeCertificateInfo/subject InfoSubject

View File

@ -52,8 +52,10 @@
#define PFNAME "x509af"
/* Initialize the protocol and registered fields */
int proto_x509af = -1;
int hf_x509af_algorithm_id = -1;
static int proto_x509af = -1;
static int hf_x509af_algorithm_id = -1;
static int hf_x509af_extension_id = -1;
static int hf_x509af_critical = -1; /* BOOLEAN */
/*--- Included file: packet-x509af-hf.c ---*/
@ -82,8 +84,6 @@ static int hf_x509af_subjectPublicKey = -1; /* BIT_STRING */
static int hf_x509af_utcTime = -1; /* UTCTime */
static int hf_x509af_generalizedTime = -1; /* GeneralizedTime */
static int hf_x509af_Extensions_item = -1; /* Extension */
static int hf_x509af_critical = -1; /* BOOLEAN */
static int hf_x509af_extnValue = -1; /* OCTET_STRING */
static int hf_x509af_userCertificate = -1; /* Certificate */
static int hf_x509af_certificationPath = -1; /* ForwardCertificationPath */
static int hf_x509af_ForwardCertificationPath_item = -1; /* CrossCertificates */
@ -172,6 +172,48 @@ static gint ett_x509af_SET_OF_AttributeType = -1;
static char extension_id[64]; /*64 chars should be long enough? */
static int
dissect_hf_x509af_extension_id(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
{
offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset,
hf_x509af_extension_id, extension_id);
return offset;
}
/* BOOLEAN from template, remove later if the compiler starts generating it */
static int
dissect_x509af_BOOLEAN(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_boolean(pinfo, tree, tvb, offset, hf_index);
return offset;
}
static int dissect_critical(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_x509af_BOOLEAN(FALSE, tvb, offset, pinfo, tree, hf_x509af_critical);
}
static int
dissect_hf_x509af_extension_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
{
offset=call_ber_oid_callback(extension_id, tvb, offset, pinfo, tree);
return offset;
}
static ber_sequence Extension_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_hf_x509af_extension_id },
{ BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_critical },
{ BER_CLASS_ANY, 0, 0, dissect_hf_x509af_extension_type },
{ 0, 0, 0, NULL }
};
static int
dissect_x509af_Extension(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
Extension_sequence, hf_index, ett_x509af_Extension);
return offset;
}
static char algorithm_id[64]; /*64 chars should be long enough? */
static int
dissect_hf_x509af_algorithm_id(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset)
@ -414,42 +456,6 @@ static int dissect_subjectPublicKeyInfo(packet_info *pinfo, proto_tree *tree, tv
return dissect_x509af_SubjectPublicKeyInfo(FALSE, tvb, offset, pinfo, tree, hf_x509af_subjectPublicKeyInfo);
}
static int
dissect_x509af_BOOLEAN(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_boolean(pinfo, tree, tvb, offset, hf_index);
return offset;
}
static int dissect_critical(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_x509af_BOOLEAN(FALSE, tvb, offset, pinfo, tree, hf_x509af_critical);
}
static int
dissect_x509af_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index,
NULL);
return offset;
}
static int dissect_extnValue(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_x509af_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_x509af_extnValue);
}
static ber_sequence Extension_sequence[] = {
{ BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_critical },
{ BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_extnValue },
{ 0, 0, 0, NULL }
};
static int
dissect_x509af_Extension(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) {
offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset,
Extension_sequence, hf_index, ett_x509af_Extension);
return offset;
}
static int dissect_Extensions_item(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) {
return dissect_x509af_Extension(FALSE, tvb, offset, pinfo, tree, hf_x509af_Extensions_item);
}
@ -921,6 +927,14 @@ void proto_register_x509af(void) {
{ "Algorithm Id", "x509af.algorithm.id",
FT_STRING, BASE_NONE, NULL, 0,
"Algorithm Id", HFILL }},
{ &hf_x509af_extension_id,
{ "Extension Id", "x509af.extension.id",
FT_STRING, BASE_NONE, NULL, 0,
"Extension Id", HFILL }},
{ &hf_x509af_critical,
{ "critical", "x509af.critical",
FT_BOOLEAN, 8, NULL, 0,
"Extension/critical", HFILL }},
/*--- Included file: packet-x509af-hfarr.c ---*/
@ -1009,14 +1023,6 @@ void proto_register_x509af(void) {
{ "Item[##]", "x509af.Extensions_item",
FT_NONE, BASE_NONE, NULL, 0,
"Extensions/_item", HFILL }},
{ &hf_x509af_critical,
{ "critical", "x509af.critical",
FT_BOOLEAN, 8, NULL, 0,
"Extension/critical", HFILL }},
{ &hf_x509af_extnValue,
{ "extnValue", "x509af.extnValue",
FT_BYTES, BASE_HEX, NULL, 0,
"Extension/extnValue", HFILL }},
{ &hf_x509af_userCertificate,
{ "userCertificate", "x509af.userCertificate",
FT_NONE, BASE_NONE, NULL, 0,