diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2004-12-05 21:47:49 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2004-12-05 21:47:49 +0000 |
commit | c20df95fd58e7ae78efaa129b4c0629e710156c0 (patch) | |
tree | 4d7a0b29c969200bde372a3c769384f0270e2a1d | |
parent | ba475d8c356d6a49e89e617ad72bd3e3cff5c57d (diff) | |
download | wireshark-c20df95fd58e7ae78efaa129b4c0629e710156c0.tar.gz wireshark-c20df95fd58e7ae78efaa129b4c0629e710156c0.tar.bz2 wireshark-c20df95fd58e7ae78efaa129b4c0629e710156c0.zip |
updates to pkix1implicit (we have to think about how to rewrite both pkix1eplicit and pkix1implicit to avoid the crap with duplicate definitions from x509)
New protocol : RFC3161 PKIX TimeStamp Protocol
svn path=/trunk/; revision=12669
-rw-r--r-- | asn1/pkix1implicit/PKIX1IMPLICIT93.asn | 24 | ||||
-rw-r--r-- | asn1/pkix1implicit/packet-pkix1implicit-template.c | 8 | ||||
-rw-r--r-- | asn1/pkix1implicit/packet-pkix1implicit-template.h | 2 | ||||
-rw-r--r-- | asn1/pkix1implicit/pkix1implicit.cnf | 4 | ||||
-rw-r--r-- | asn1/pkix1implicit/pkix1implicit_exp.cnf | 2 | ||||
-rwxr-xr-x | asn1/pkixtsp/Makefile | 5 | ||||
-rw-r--r-- | asn1/pkixtsp/PKIXTSP.asn | 177 | ||||
-rw-r--r-- | asn1/pkixtsp/packet-pkixtsp-template.c | 144 | ||||
-rw-r--r-- | asn1/pkixtsp/packet-pkixtsp-template.h | 32 | ||||
-rw-r--r-- | asn1/pkixtsp/pkixtsp.cnf | 31 | ||||
-rw-r--r-- | epan/dissectors/Makefile.common | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-pkix1implicit.c | 130 | ||||
-rw-r--r-- | epan/dissectors/packet-pkix1implicit.h | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-pkixtsp.c | 635 | ||||
-rw-r--r-- | epan/dissectors/packet-pkixtsp.h | 39 |
15 files changed, 1111 insertions, 126 deletions
diff --git a/asn1/pkix1implicit/PKIX1IMPLICIT93.asn b/asn1/pkix1implicit/PKIX1IMPLICIT93.asn index 828b1898a4..ded089d4c2 100644 --- a/asn1/pkix1implicit/PKIX1IMPLICIT93.asn +++ b/asn1/pkix1implicit/PKIX1IMPLICIT93.asn @@ -64,7 +64,9 @@ IMPORTS Attribute, EXTENSION FROM PKIX1Explicit93 {iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) - id-mod(0) id-pkix1-explicit-93(3)}; + id-mod(0) id-pkix1-explicit-93(3)} + GeneralName FROM CertificateExtensions; + -- Key and policy information extensions -- @@ -177,17 +179,19 @@ Dummy ::= NULL -- IDENTIFIED BY id-ce-subjectAltName } -- --GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName - -GeneralName ::= CHOICE { +-- +--Imported from X509CE +--GeneralName ::= CHOICE { -- otherName [0] INSTANCE OF OTHER-NAME, - rfc822Name [1] IA5String, - dNSName [2] IA5String, +-- rfc822Name [1] IA5String, +-- dNSName [2] IA5String, -- x400Address [3] ORAddress, - directoryName [4] Name, - ediPartyName [5] EDIPartyName, - uniformResourceIdentifier [6] IA5String, - iPAddress [7] OCTET STRING, - registeredID [8] OBJECT IDENTIFIER } +-- directoryName [4] Name, +-- ediPartyName [5] EDIPartyName, +-- uniformResourceIdentifier [6] IA5String, +-- iPAddress [7] OCTET STRING, +-- registeredID [8] OBJECT IDENTIFIER +--} --OTHER-NAME ::= TYPE-IDENTIFIER diff --git a/asn1/pkix1implicit/packet-pkix1implicit-template.c b/asn1/pkix1implicit/packet-pkix1implicit-template.c index 15763907e4..bc6e0c1d14 100644 --- a/asn1/pkix1implicit/packet-pkix1implicit-template.c +++ b/asn1/pkix1implicit/packet-pkix1implicit-template.c @@ -36,6 +36,7 @@ #include "packet-ber.h" #include "packet-pkix1implicit.h" #include "packet-pkix1explicit.h" +#include "packet-x509ce.h" #define PNAME "PKIX1Implitit" #define PSNAME "PKIX1IMPLICIT" @@ -49,6 +50,13 @@ static int proto_pkix1implicit = -1; #include "packet-pkix1implicit-ett.c" +int +dissect_pkix1implicit_GeneralName(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_x509ce_GeneralName(implicit_tag, tvb, offset, pinfo, tree, hf_index); + + return offset; +} + #include "packet-pkix1implicit-fn.c" diff --git a/asn1/pkix1implicit/packet-pkix1implicit-template.h b/asn1/pkix1implicit/packet-pkix1implicit-template.h index 12b712b5bc..d6f860cf1f 100644 --- a/asn1/pkix1implicit/packet-pkix1implicit-template.h +++ b/asn1/pkix1implicit/packet-pkix1implicit-template.h @@ -25,6 +25,8 @@ #ifndef PACKET_PKIX1IMPLICIT_H #define PACKET_PKIX1IMPLICIT_H +int dissect_pkix1implicit_GeneralName(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_); + #include "packet-pkix1implicit-exp.h" #endif /* PACKET_PKIX1IMPLICIT_H */ diff --git a/asn1/pkix1implicit/pkix1implicit.cnf b/asn1/pkix1implicit/pkix1implicit.cnf index bae9431e17..7aea434712 100644 --- a/asn1/pkix1implicit/pkix1implicit.cnf +++ b/asn1/pkix1implicit/pkix1implicit.cnf @@ -5,13 +5,15 @@ #.MODULE_IMPORT PKIX1Explicit93 pkix1explicit +CertificateExtensions x509ce #.INCLUDE ../pkix1explicit/pkix1explicit_exp.cnf +#.INCLUDE ../x509ce/x509ce-exp.cnf #.EXPORTS -UserNotice AuthorityInfoAccessSyntax +UserNotice #.PDU diff --git a/asn1/pkix1implicit/pkix1implicit_exp.cnf b/asn1/pkix1implicit/pkix1implicit_exp.cnf index 38d515bca5..849f073b1a 100644 --- a/asn1/pkix1implicit/pkix1implicit_exp.cnf +++ b/asn1/pkix1implicit/pkix1implicit_exp.cnf @@ -1,11 +1,13 @@ #.IMPORT_TAG AuthorityInfoAccessSyntax BER_CLASS_UNI BER_UNI_TAG_SEQUENCE +GeneralName BER_CLASS_CON -1/*choice*/ UserNotice BER_CLASS_UNI BER_UNI_TAG_SEQUENCE #.END #.TYPE_ATTR AuthorityInfoAccessSyntax TYPE = FT_UINT32 DISPLAY = BASE_DEC STRINGS = NULL BITMASK = 0 +GeneralName TYPE = FT_UINT32 DISPLAY = BASE_DEC STRINGS = NULL BITMASK = 0 UserNotice TYPE = FT_NONE DISPLAY = BASE_NONE STRINGS = NULL BITMASK = 0 #.END diff --git a/asn1/pkixtsp/Makefile b/asn1/pkixtsp/Makefile new file mode 100755 index 0000000000..5181ff1160 --- /dev/null +++ b/asn1/pkixtsp/Makefile @@ -0,0 +1,5 @@ + +../../epan/dissectors/packet-pkixtsp.c : ../../tools/asn2eth.py PKIXTSP.asn packet-pkixtsp-template.c packet-pkixtsp-template.h pkixtsp.cnf + python ../../tools/asn2eth.py -X -b -k -e -p pkixtsp -c pkixtsp.cnf -s packet-pkixtsp-template PKIXTSP.asn + cp packet-pkixtsp.* ../../epan/dissectors + diff --git a/asn1/pkixtsp/PKIXTSP.asn b/asn1/pkixtsp/PKIXTSP.asn new file mode 100644 index 0000000000..306f4a9893 --- /dev/null +++ b/asn1/pkixtsp/PKIXTSP.asn @@ -0,0 +1,177 @@ +-- This ASN.1 definition defined the Time-Stamp Protocol +-- as of RFC3161. +-- This definition is taken from RFC3161 and modified to pass through +-- the ASN2ETH compiler. +-- +-- Copyright statement of the original ASN.1 definition of RFC3161 as follows +-- +-- +-- Full Copyright Statement +-- +-- Copyright (C) The Internet Society (2001). All Rights Reserved. +-- +-- This document and translations of it may be copied and furnished to +-- others, and derivative works that comment on or otherwise explain it +-- or assist in its implementation may be prepared, copied, published +-- and distributed, in whole or in part, without restriction of any +-- kind, provided that the above copyright notice and this paragraph are +-- included on all such copies and derivative works. However, this +-- document itself may not be modified in any way, such as by removing +-- the copyright notice or references to the Internet Society or other +-- Internet organizations, except as needed for the purpose of +-- developing Internet standards in which case the procedures for +-- copyrights defined in the Internet Standards process must be +-- followed, or as required to translate it into languages other than +-- English. +-- +-- The limited permissions granted above are perpetual and will not be +-- revoked by the Internet Society or its successors or assigns. +-- +-- This document and the information contained herein is provided on an +-- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING +-- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING +-- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION +-- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF +-- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +PKIXTSP {iso(1) identified-organization(3) dod(6) internet(1) + security(5) mechanisms(5) pkix(7) id-mod(0) id-mod-tsp(13)} + +DEFINITIONS IMPLICIT TAGS ::= + +BEGIN + +-- EXPORTS ALL -- + +IMPORTS + + Extensions, AlgorithmIdentifier + FROM PKIX1Explicit88 {iso(1) identified-organization(3) + dod(6) internet(1) security(5) mechanisms(5) pkix(7) + id-mod(0) id-pkix1-explicit-88(1)} + + GeneralName FROM PKIX1Implicit88 {iso(1) + identified-organization(3) dod(6) internet(1) security(5) + mechanisms(5) pkix(7) id-mod(0) id-pkix1-implicit-88(2)} + + ContentInfo FROM CryptographicMessageSyntax {iso(1) + member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) + smime(16) modules(0) cms(1)} + + PKIFreeText FROM PKIXCMP {iso(1) identified-organization(3) + dod(6) internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) + id-mod-cmp(9)} ; + + -- Locally defined OIDs -- + +-- eContentType for a time-stamp token + +-- id-ct-TSTInfo OBJECT IDENTIFIER ::= { iso(1) member-body(2) +-- us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) ct(1) 4} + +-- 2.4.1 + +TimeStampReq ::= SEQUENCE { + version INTEGER { v1(1) }, + messageImprint MessageImprint, + --a hash algorithm OID and the hash value of the data to be + --time-stamped + reqPolicy TSAPolicyId OPTIONAL, + nonce INTEGER OPTIONAL, + certReq BOOLEAN DEFAULT FALSE, + extensions [0] IMPLICIT Extensions OPTIONAL } + +MessageImprint ::= SEQUENCE { + hashAlgorithm AlgorithmIdentifier, + hashedMessage OCTET STRING } + +TSAPolicyId ::= OBJECT IDENTIFIER + + +-- 2.4.2 + +TimeStampResp ::= SEQUENCE { + status PKIStatusInfo, + timeStampToken TimeStampToken OPTIONAL } + +-- The status is based on the definition of status +-- in section 3.2.3 of [RFC2510] + +PKIStatusInfo ::= SEQUENCE { + status PKIStatus, +--XXX dont implement PKIXCMP yet +-- statusString PKIFreeText OPTIONAL, + failInfo PKIFailureInfo OPTIONAL } + +PKIStatus ::= INTEGER { + granted (0), + -- when the PKIStatus contains the value zero a TimeStampToken, as + -- requested, is present. + grantedWithMods (1), + -- when the PKIStatus contains the value one a TimeStampToken, + -- with modifications, is present. + rejection (2), + waiting (3), + revocationWarning (4), + -- this message contains a warning that a revocation is + -- imminent + revocationNotification (5) + -- notification that a revocation has occurred +} + + -- When the TimeStampToken is not present + -- failInfo indicates the reason why the + -- time-stamp request was rejected and + -- may be one of the following values. + +PKIFailureInfo ::= BIT STRING { + badAlg (0), + -- unrecognized or unsupported Algorithm Identifier + badRequest (2), + -- transaction not permitted or supported + badDataFormat (5), + -- the data submitted has the wrong format + timeNotAvailable (14), + -- the TSA's time source is not available + unacceptedPolicy (15), + -- the requested TSA policy is not supported by the TSA. + unacceptedExtension (16), + -- the requested extension is not supported by the TSA. + addInfoNotAvailable (17), + -- the additional information requested could not be understood + -- or is not available + systemFailure (25) + -- the request cannot be handled due to system failure +} + +TimeStampToken ::= ContentInfo + + -- contentType is id-signedData as defined in [CMS] + -- content is SignedData as defined in([CMS]) + -- eContentType within SignedData is id-ct-TSTInfo + -- eContent within SignedData is TSTInfo + +TSTInfo ::= SEQUENCE { + version INTEGER { v1(1) }, + policy TSAPolicyId, + messageImprint MessageImprint, + -- MUST have the same value as the similar field in + -- TimeStampReq + serialNumber INTEGER, + -- Time-Stamping users MUST be ready to accommodate integers + -- up to 160 bits. + genTime GeneralizedTime, + accuracy Accuracy OPTIONAL, + ordering BOOLEAN DEFAULT FALSE, + nonce INTEGER OPTIONAL, + -- MUST be present if the similar field was present + -- in TimeStampReq. In that case it MUST have the same value. + tsa [0] GeneralName OPTIONAL, + extensions [1] IMPLICIT Extensions OPTIONAL } + +Accuracy ::= SEQUENCE { + seconds INTEGER OPTIONAL, + millis [0] INTEGER (1..999) OPTIONAL, + micros [1] INTEGER (1..999) OPTIONAL } + +END diff --git a/asn1/pkixtsp/packet-pkixtsp-template.c b/asn1/pkixtsp/packet-pkixtsp-template.c new file mode 100644 index 0000000000..25300f70f7 --- /dev/null +++ b/asn1/pkixtsp/packet-pkixtsp-template.c @@ -0,0 +1,144 @@ +/* packet-pkixtsp.c + * Routines for RFC2634 Extended Security Services packet dissection + * Ronnie Sahlberg 2004 + * + * $Id: packet-pkixtsp-template.c 12438 2004-10-30 02:36:58Z sahlberg $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <glib.h> +#include <epan/packet.h> + +#include <stdio.h> +#include <string.h> + +#include "packet-ber.h" +#include "packet-pkixtsp.h" +#include "packet-pkix1explicit.h" +#include "packet-pkix1implicit.h" +#include "packet-cms.h" + +#define PNAME "PKIX Time Stamp Protocol" +#define PSNAME "PKIXTSP" +#define PFNAME "pkixtsp" + +/* Initialize the protocol and registered fields */ +static int proto_pkixtsp = -1; +#include "packet-pkixtsp-hf.c" + +/* Initialize the subtree pointers */ +static gint ett_pkixtsp = -1; +#include "packet-pkixtsp-ett.c" + + +#include "packet-pkixtsp-fn.c" + + +static int +dissect_timestamp_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +{ + proto_item *item=NULL; + proto_tree *tree=NULL; + + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "PKIXTSP"); + + if (check_col(pinfo->cinfo, COL_INFO)) { + col_clear(pinfo->cinfo, COL_INFO); + + col_add_fstr(pinfo->cinfo, COL_INFO, "Reply"); + } + + + if(parent_tree){ + item=proto_tree_add_item(parent_tree, proto_pkixtsp, tvb, 0, -1, FALSE); + tree = proto_item_add_subtree(item, ett_pkixtsp); + } + + return dissect_pkixtsp_TimeStampResp(FALSE, tvb, 0, pinfo, tree, -1); +} + +static int +dissect_timestamp_query(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +{ + proto_item *item=NULL; + proto_tree *tree=NULL; + + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "PKIXTSP"); + + if (check_col(pinfo->cinfo, COL_INFO)) { + col_clear(pinfo->cinfo, COL_INFO); + + col_add_fstr(pinfo->cinfo, COL_INFO, "Query"); + } + + + if(parent_tree){ + item=proto_tree_add_item(parent_tree, proto_pkixtsp, tvb, 0, -1, FALSE); + tree = proto_item_add_subtree(item, ett_pkixtsp); + } + + return dissect_pkixtsp_TimeStampReq(FALSE, tvb, 0, pinfo, tree, -1); +} + + +/*--- proto_register_pkixtsp ----------------------------------------------*/ +void proto_register_pkixtsp(void) { + + /* List of fields */ + static hf_register_info hf[] = { +#include "packet-pkixtsp-hfarr.c" + }; + + /* List of subtrees */ + static gint *ett[] = { + &ett_pkixtsp, +#include "packet-pkixtsp-ettarr.c" + }; + + /* Register protocol */ + proto_pkixtsp = proto_register_protocol(PNAME, PSNAME, PFNAME); + + /* Register fields and subtrees */ + proto_register_field_array(proto_pkixtsp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + +} + + +/*--- proto_reg_handoff_pkixtsp -------------------------------------------*/ +void proto_reg_handoff_pkixtsp(void) { + dissector_handle_t timestamp_reply_handle; + dissector_handle_t timestamp_query_handle; + + timestamp_reply_handle = new_create_dissector_handle(dissect_timestamp_reply, proto_pkixtsp); + dissector_add_string("media_type", "application/timestamp-reply", timestamp_reply_handle); + + timestamp_query_handle = new_create_dissector_handle(dissect_timestamp_query, proto_pkixtsp); + dissector_add_string("media_type", "application/timestamp-query", timestamp_query_handle); + +/*#include "packet-pkixtsp-dis-tab.c"*/ +} + diff --git a/asn1/pkixtsp/packet-pkixtsp-template.h b/asn1/pkixtsp/packet-pkixtsp-template.h new file mode 100644 index 0000000000..7907b56501 --- /dev/null +++ b/asn1/pkixtsp/packet-pkixtsp-template.h @@ -0,0 +1,32 @@ +/* packet-pkixtsp.h + * Routines for RFC3161 Time-Stamp Protocol packet dissection + * Ronnie Sahlberg 2004 + * + * $Id: packet-pkixtsp-template.h 12437 2004-10-30 02:18:44Z sahlberg $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef PACKET_PKIXTSP_H +#define PACKET_PKIXTSP_H + +/*#include "packet-pkixtsp-exp.h"*/ + +#endif /* PACKET_PKIXTSP_H */ + diff --git a/asn1/pkixtsp/pkixtsp.cnf b/asn1/pkixtsp/pkixtsp.cnf new file mode 100644 index 0000000000..edfe3b4410 --- /dev/null +++ b/asn1/pkixtsp/pkixtsp.cnf @@ -0,0 +1,31 @@ +# pkixtsp.cnf +# Time-Stamp Protocol (RFC3161) conformation file + +# $Id: pkixtsp.cnf 12558 2004-11-21 10:16:06Z sahlberg $ + +#.MODULE_IMPORT +PKIX1Explicit88 pkix1explicit +PKIX1Implicit88 pkix1implicit +CryptographicMessageSyntax cms + +#.INCLUDE ../pkix1explicit/pkix1explicit_exp.cnf +#.INCLUDE ../pkix1implicit/pkix1implicit_exp.cnf +#.INCLUDE ../cms/cms-exp.cnf + +#.EXPORTS + +#.PDU + +#.REGISTER + +#.NO_EMIT + +#.TYPE_RENAME +TSTInfo/version tst_version + +#.FIELD_RENAME +PKIStatusInfo/status pki_status +TSTInfo/version tst_version + +#.END + diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common index 6a89c015cf..822e287705 100644 --- a/epan/dissectors/Makefile.common +++ b/epan/dissectors/Makefile.common @@ -397,6 +397,7 @@ DISSECTOR_SRC = \ packet-pkix1implicit.c \ packet-pkixproxy.c \ packet-pkixqualified.c \ + packet-pkixtsp.c \ packet-pkinit.c \ packet-pktc.c \ packet-pop.c \ @@ -688,6 +689,7 @@ DISSECTOR_INCLUDES = \ packet-pkix1implicit.h \ packet-pkixproxy.h \ packet-pkixqualified.h \ + packet-pkixtsp.h \ packet-pkinit.h \ packet-pktc.h \ packet-portmap.h \ diff --git a/epan/dissectors/packet-pkix1implicit.c b/epan/dissectors/packet-pkix1implicit.c index 877da18019..8c23105051 100644 --- a/epan/dissectors/packet-pkix1implicit.c +++ b/epan/dissectors/packet-pkix1implicit.c @@ -43,6 +43,7 @@ #include "packet-ber.h" #include "packet-pkix1implicit.h" #include "packet-pkix1explicit.h" +#include "packet-x509ce.h" #define PNAME "PKIX1Implitit" #define PSNAME "PKIX1IMPLICIT" @@ -55,13 +56,6 @@ static int proto_pkix1implicit = -1; static int hf_pkix1implicit_Dummy_PDU = -1; /* Dummy */ static int hf_pkix1implicit_AuthorityInfoAccessSyntax_PDU = -1; /* AuthorityInfoAccessSyntax */ -static int hf_pkix1implicit_rfc822Name = -1; /* IA5String */ -static int hf_pkix1implicit_dNSName = -1; /* IA5String */ -static int hf_pkix1implicit_directoryName = -1; /* Name */ -static int hf_pkix1implicit_ediPartyName = -1; /* EDIPartyName */ -static int hf_pkix1implicit_uniformResourceIdentifier = -1; /* IA5String */ -static int hf_pkix1implicit_iPAddress = -1; /* OCTET_STRING */ -static int hf_pkix1implicit_registeredID = -1; /* OBJECT_IDENTIFIER */ static int hf_pkix1implicit_nameAssigner = -1; /* DirectoryString */ static int hf_pkix1implicit_partyName = -1; /* DirectoryString */ static int hf_pkix1implicit_AuthorityInfoAccessSyntax_item = -1; /* AccessDescription */ @@ -83,7 +77,6 @@ static int hf_pkix1implicit_utf8String = -1; /* UTF8String */ /*--- Included file: packet-pkix1implicit-ett.c ---*/ -static gint ett_pkix1implicit_GeneralName = -1; static gint ett_pkix1implicit_EDIPartyName = -1; static gint ett_pkix1implicit_AuthorityInfoAccessSyntax = -1; static gint ett_pkix1implicit_AccessDescription = -1; @@ -96,20 +89,27 @@ static gint ett_pkix1implicit_DisplayText = -1; +int +dissect_pkix1implicit_GeneralName(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_x509ce_GeneralName(implicit_tag, tvb, offset, pinfo, tree, hf_index); + + return offset; +} + /*--- Included file: packet-pkix1implicit-fn.c ---*/ /*--- Fields for imported types ---*/ -static int dissect_directoryName_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { - return dissect_pkix1explicit_Name(TRUE, tvb, offset, pinfo, tree, hf_pkix1implicit_directoryName); -} static int dissect_nameAssigner_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { return dissect_pkix1explicit_DirectoryString(TRUE, tvb, offset, pinfo, tree, hf_pkix1implicit_nameAssigner); } static int dissect_partyName_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { return dissect_pkix1explicit_DirectoryString(TRUE, tvb, offset, pinfo, tree, hf_pkix1implicit_partyName); } +static int dissect_accessLocation(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_x509ce_GeneralName(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_accessLocation); +} static int @@ -122,25 +122,6 @@ dissect_pkix1implicit_Dummy(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset return offset; } - -static int -dissect_pkix1implicit_IA5String(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { - offset = dissect_ber_restricted_string(implicit_tag, 1, - pinfo, tree, tvb, offset, hf_index, - NULL); - - return offset; -} -static int dissect_rfc822Name_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { - return dissect_pkix1implicit_IA5String(TRUE, tvb, offset, pinfo, tree, hf_pkix1implicit_rfc822Name); -} -static int dissect_dNSName_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { - return dissect_pkix1implicit_IA5String(TRUE, tvb, offset, pinfo, tree, hf_pkix1implicit_dNSName); -} -static int dissect_uniformResourceIdentifier_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { - return dissect_pkix1implicit_IA5String(TRUE, tvb, offset, pinfo, tree, hf_pkix1implicit_uniformResourceIdentifier); -} - static const ber_sequence EDIPartyName_sequence[] = { { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_nameAssigner_impl }, { BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_partyName_impl }, @@ -154,21 +135,6 @@ dissect_pkix1implicit_EDIPartyName(gboolean implicit_tag _U_, tvbuff_t *tvb, int return offset; } -static int dissect_ediPartyName_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { - return dissect_pkix1implicit_EDIPartyName(TRUE, tvb, offset, pinfo, tree, hf_pkix1implicit_ediPartyName); -} - - -static int -dissect_pkix1implicit_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { - offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index, - NULL); - - return offset; -} -static int dissect_iPAddress_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { - return dissect_pkix1implicit_OCTET_STRING(TRUE, tvb, offset, pinfo, tree, hf_pkix1implicit_iPAddress); -} static int @@ -178,50 +144,13 @@ dissect_pkix1implicit_OBJECT_IDENTIFIER(gboolean implicit_tag _U_, tvbuff_t *tvb return offset; } -static int dissect_registeredID_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { - return dissect_pkix1implicit_OBJECT_IDENTIFIER(TRUE, tvb, offset, pinfo, tree, hf_pkix1implicit_registeredID); -} static int dissect_accessMethod(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { return dissect_pkix1implicit_OBJECT_IDENTIFIER(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_accessMethod); } - -static const value_string GeneralName_vals[] = { - { 1, "rfc822Name" }, - { 2, "dNSName" }, - { 4, "directoryName" }, - { 5, "ediPartyName" }, - { 6, "uniformResourceIdentifier" }, - { 7, "iPAddress" }, - { 8, "registeredID" }, - { 0, NULL } -}; - -static const ber_choice GeneralName_choice[] = { - { 1, BER_CLASS_CON, 1, 0, dissect_rfc822Name_impl }, - { 2, BER_CLASS_CON, 2, 0, dissect_dNSName_impl }, - { 4, BER_CLASS_CON, 4, 0, dissect_directoryName_impl }, - { 5, BER_CLASS_CON, 5, 0, dissect_ediPartyName_impl }, - { 6, BER_CLASS_CON, 6, 0, dissect_uniformResourceIdentifier_impl }, - { 7, BER_CLASS_CON, 7, 0, dissect_iPAddress_impl }, - { 8, BER_CLASS_CON, 8, 0, dissect_registeredID_impl }, - { 0, 0, 0, 0, NULL } -}; - -static int -dissect_pkix1implicit_GeneralName(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { - offset = dissect_ber_choice(pinfo, tree, tvb, offset, - GeneralName_choice, hf_index, ett_pkix1implicit_GeneralName); - - return offset; -} -static int dissect_accessLocation(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { - return dissect_pkix1implicit_GeneralName(FALSE, tvb, offset, pinfo, tree, hf_pkix1implicit_accessLocation); -} - static const ber_sequence AccessDescription_sequence[] = { { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_accessMethod }, - { BER_CLASS_CON, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_accessLocation }, + { BER_CLASS_CON, -1/*choice*/, BER_FLAGS_NOOWNTAG, dissect_accessLocation }, { 0, 0, 0, NULL } }; @@ -404,41 +333,13 @@ void proto_register_pkix1implicit(void) { { "AuthorityInfoAccessSyntax", "pkix1implicit.AuthorityInfoAccessSyntax", FT_UINT32, BASE_DEC, NULL, 0, "AuthorityInfoAccessSyntax", HFILL }}, - { &hf_pkix1implicit_rfc822Name, - { "rfc822Name", "pkix1implicit.rfc822Name", - FT_STRING, BASE_NONE, NULL, 0, - "GeneralName/rfc822Name", HFILL }}, - { &hf_pkix1implicit_dNSName, - { "dNSName", "pkix1implicit.dNSName", - FT_STRING, BASE_NONE, NULL, 0, - "GeneralName/dNSName", HFILL }}, - { &hf_pkix1implicit_directoryName, - { "directoryName", "pkix1implicit.directoryName", - FT_UINT32, BASE_DEC, NULL, 0, - "GeneralName/directoryName", HFILL }}, - { &hf_pkix1implicit_ediPartyName, - { "ediPartyName", "pkix1implicit.ediPartyName", - FT_NONE, BASE_NONE, NULL, 0, - "GeneralName/ediPartyName", HFILL }}, - { &hf_pkix1implicit_uniformResourceIdentifier, - { "uniformResourceIdentifier", "pkix1implicit.uniformResourceIdentifier", - FT_STRING, BASE_NONE, NULL, 0, - "GeneralName/uniformResourceIdentifier", HFILL }}, - { &hf_pkix1implicit_iPAddress, - { "iPAddress", "pkix1implicit.iPAddress", - FT_BYTES, BASE_HEX, NULL, 0, - "GeneralName/iPAddress", HFILL }}, - { &hf_pkix1implicit_registeredID, - { "registeredID", "pkix1implicit.registeredID", - FT_STRING, BASE_NONE, NULL, 0, - "GeneralName/registeredID", HFILL }}, { &hf_pkix1implicit_nameAssigner, { "nameAssigner", "pkix1implicit.nameAssigner", - FT_NONE, BASE_NONE, NULL, 0, + FT_STRING, BASE_NONE, NULL, 0, "EDIPartyName/nameAssigner", HFILL }}, { &hf_pkix1implicit_partyName, { "partyName", "pkix1implicit.partyName", - FT_NONE, BASE_NONE, NULL, 0, + FT_STRING, BASE_NONE, NULL, 0, "EDIPartyName/partyName", HFILL }}, { &hf_pkix1implicit_AuthorityInfoAccessSyntax_item, { "Item", "pkix1implicit.AuthorityInfoAccessSyntax_item", @@ -450,7 +351,7 @@ void proto_register_pkix1implicit(void) { "AccessDescription/accessMethod", HFILL }}, { &hf_pkix1implicit_accessLocation, { "accessLocation", "pkix1implicit.accessLocation", - FT_UINT32, BASE_DEC, VALS(GeneralName_vals), 0, + FT_UINT32, BASE_DEC, NULL, 0, "AccessDescription/accessLocation", HFILL }}, { &hf_pkix1implicit_noticeRef, { "noticeRef", "pkix1implicit.noticeRef", @@ -494,7 +395,6 @@ void proto_register_pkix1implicit(void) { /*--- Included file: packet-pkix1implicit-ettarr.c ---*/ - &ett_pkix1implicit_GeneralName, &ett_pkix1implicit_EDIPartyName, &ett_pkix1implicit_AuthorityInfoAccessSyntax, &ett_pkix1implicit_AccessDescription, diff --git a/epan/dissectors/packet-pkix1implicit.h b/epan/dissectors/packet-pkix1implicit.h index c6d08f7a00..f88246c553 100644 --- a/epan/dissectors/packet-pkix1implicit.h +++ b/epan/dissectors/packet-pkix1implicit.h @@ -32,6 +32,8 @@ #ifndef PACKET_PKIX1IMPLICIT_H #define PACKET_PKIX1IMPLICIT_H +int dissect_pkix1implicit_GeneralName(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_); + /*--- Included file: packet-pkix1implicit-exp.h ---*/ diff --git a/epan/dissectors/packet-pkixtsp.c b/epan/dissectors/packet-pkixtsp.c new file mode 100644 index 0000000000..49dc222bb6 --- /dev/null +++ b/epan/dissectors/packet-pkixtsp.c @@ -0,0 +1,635 @@ +/* Do not modify this file. */ +/* It is created automatically by the ASN.1 to Ethereal dissector compiler */ +/* ./packet-pkixtsp.c */ +/* ../../tools/asn2eth.py -X -b -k -e -p pkixtsp -c pkixtsp.cnf -s packet-pkixtsp-template PKIXTSP.asn */ + +/* Input file: packet-pkixtsp-template.c */ + +/* packet-pkixtsp.c + * Routines for RFC2634 Extended Security Services packet dissection + * Ronnie Sahlberg 2004 + * + * $Id: packet-pkixtsp-template.c 12438 2004-10-30 02:36:58Z sahlberg $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <glib.h> +#include <epan/packet.h> + +#include <stdio.h> +#include <string.h> + +#include "packet-ber.h" +#include "packet-pkixtsp.h" +#include "packet-pkix1explicit.h" +#include "packet-pkix1implicit.h" +#include "packet-cms.h" + +#define PNAME "PKIX Time Stamp Protocol" +#define PSNAME "PKIXTSP" +#define PFNAME "pkixtsp" + +/* Initialize the protocol and registered fields */ +static int proto_pkixtsp = -1; + +/*--- Included file: packet-pkixtsp-hf.c ---*/ + +static int hf_pkixtsp_version = -1; /* T_version */ +static int hf_pkixtsp_messageImprint = -1; /* MessageImprint */ +static int hf_pkixtsp_reqPolicy = -1; /* TSAPolicyId */ +static int hf_pkixtsp_nonce = -1; /* INTEGER */ +static int hf_pkixtsp_certReq = -1; /* BOOLEAN */ +static int hf_pkixtsp_extensions = -1; /* Extensions */ +static int hf_pkixtsp_hashAlgorithm = -1; /* AlgorithmIdentifier */ +static int hf_pkixtsp_hashedMessage = -1; /* OCTET_STRING */ +static int hf_pkixtsp_status = -1; /* PKIStatusInfo */ +static int hf_pkixtsp_timeStampToken = -1; /* TimeStampToken */ +static int hf_pkixtsp_pki_status = -1; /* PKIStatus */ +static int hf_pkixtsp_failInfo = -1; /* PKIFailureInfo */ +static int hf_pkixtsp_tst_version = -1; /* tst_version */ +static int hf_pkixtsp_policy = -1; /* TSAPolicyId */ +static int hf_pkixtsp_serialNumber = -1; /* INTEGER */ +static int hf_pkixtsp_genTime = -1; /* GeneralizedTime */ +static int hf_pkixtsp_accuracy = -1; /* Accuracy */ +static int hf_pkixtsp_ordering = -1; /* BOOLEAN */ +static int hf_pkixtsp_tsa = -1; /* GeneralName */ +static int hf_pkixtsp_seconds = -1; /* INTEGER */ +static int hf_pkixtsp_millis = -1; /* INTEGER_1_999 */ +static int hf_pkixtsp_micros = -1; /* INTEGER_1_999 */ +/* named bits */ +static int hf_pkixtsp_PKIFailureInfo_badAlg = -1; +static int hf_pkixtsp_PKIFailureInfo_badRequest = -1; +static int hf_pkixtsp_PKIFailureInfo_badDataFormat = -1; +static int hf_pkixtsp_PKIFailureInfo_timeNotAvailable = -1; +static int hf_pkixtsp_PKIFailureInfo_unacceptedPolicy = -1; +static int hf_pkixtsp_PKIFailureInfo_unacceptedExtension = -1; +static int hf_pkixtsp_PKIFailureInfo_addInfoNotAvailable = -1; +static int hf_pkixtsp_PKIFailureInfo_systemFailure = -1; + +/*--- End of included file: packet-pkixtsp-hf.c ---*/ + + +/* Initialize the subtree pointers */ +static gint ett_pkixtsp = -1; + +/*--- Included file: packet-pkixtsp-ett.c ---*/ + +static gint ett_pkixtsp_TimeStampReq = -1; +static gint ett_pkixtsp_MessageImprint = -1; +static gint ett_pkixtsp_TimeStampResp = -1; +static gint ett_pkixtsp_PKIStatusInfo = -1; +static gint ett_pkixtsp_PKIFailureInfo = -1; +static gint ett_pkixtsp_TSTInfo = -1; +static gint ett_pkixtsp_Accuracy = -1; + +/*--- End of included file: packet-pkixtsp-ett.c ---*/ + + + + +/*--- Included file: packet-pkixtsp-fn.c ---*/ + +/*--- Fields for imported types ---*/ + +static int dissect_extensions_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkix1explicit_Extensions(TRUE, tvb, offset, pinfo, tree, hf_pkixtsp_extensions); +} +static int dissect_hashAlgorithm(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkix1explicit_AlgorithmIdentifier(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_hashAlgorithm); +} +static int dissect_tsa_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkix1implicit_GeneralName(TRUE, tvb, offset, pinfo, tree, hf_pkixtsp_tsa); +} + + +static const value_string T_version_vals[] = { + { 1, "v1" }, + { 0, NULL } +}; + + +static int +dissect_pkixtsp_T_version(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_ber_integer_new(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL); + + return offset; +} +static int dissect_version(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_T_version(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_version); +} + + +static int +dissect_pkixtsp_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index, + NULL); + + return offset; +} +static int dissect_hashedMessage(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_hashedMessage); +} + +static const ber_sequence MessageImprint_sequence[] = { + { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_hashAlgorithm }, + { BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_hashedMessage }, + { 0, 0, 0, NULL } +}; + +static int +dissect_pkixtsp_MessageImprint(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset, + MessageImprint_sequence, hf_index, ett_pkixtsp_MessageImprint); + + return offset; +} +static int dissect_messageImprint(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_MessageImprint(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_messageImprint); +} + + +static int +dissect_pkixtsp_TSAPolicyId(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_ber_object_identifier(implicit_tag, pinfo, tree, tvb, offset, + hf_index, NULL); + + return offset; +} +static int dissect_reqPolicy(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_TSAPolicyId(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_reqPolicy); +} +static int dissect_policy(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_TSAPolicyId(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_policy); +} + + + +static int +dissect_pkixtsp_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_ber_integer_new(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL); + + return offset; +} +static int dissect_nonce(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_nonce); +} +static int dissect_serialNumber(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_serialNumber); +} +static int dissect_seconds(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_INTEGER(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_seconds); +} + + +static int +dissect_pkixtsp_BOOLEAN(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_ber_boolean(pinfo, tree, tvb, offset, hf_index); + + return offset; +} +static int dissect_certReq(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_BOOLEAN(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_certReq); +} +static int dissect_ordering(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_BOOLEAN(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_ordering); +} + +static const ber_sequence TimeStampReq_sequence[] = { + { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_version }, + { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_messageImprint }, + { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_reqPolicy }, + { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_nonce }, + { BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_certReq }, + { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_extensions_impl }, + { 0, 0, 0, NULL } +}; + +static int +dissect_pkixtsp_TimeStampReq(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset, + TimeStampReq_sequence, hf_index, ett_pkixtsp_TimeStampReq); + + return offset; +} + + +static const value_string PKIStatus_vals[] = { + { 0, "granted" }, + { 1, "grantedWithMods" }, + { 2, "rejection" }, + { 3, "waiting" }, + { 4, "revocationWarning" }, + { 5, "revocationNotification" }, + { 0, NULL } +}; + + +static int +dissect_pkixtsp_PKIStatus(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_ber_integer_new(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL); + + return offset; +} +static int dissect_pki_status(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_PKIStatus(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_pki_status); +} + +static const asn_namedbit PKIFailureInfo_bits[] = { + { 0, &hf_pkixtsp_PKIFailureInfo_badAlg, -1, -1, NULL, NULL }, + { 2, &hf_pkixtsp_PKIFailureInfo_badRequest, -1, -1, NULL, NULL }, + { 5, &hf_pkixtsp_PKIFailureInfo_badDataFormat, -1, -1, NULL, NULL }, + { 14, &hf_pkixtsp_PKIFailureInfo_timeNotAvailable, -1, -1, NULL, NULL }, + { 15, &hf_pkixtsp_PKIFailureInfo_unacceptedPolicy, -1, -1, NULL, NULL }, + { 16, &hf_pkixtsp_PKIFailureInfo_unacceptedExtension, -1, -1, NULL, NULL }, + { 17, &hf_pkixtsp_PKIFailureInfo_addInfoNotAvailable, -1, -1, NULL, NULL }, + { 25, &hf_pkixtsp_PKIFailureInfo_systemFailure, -1, -1, NULL, NULL }, + { 0, NULL, 0, 0, NULL, NULL } +}; + +static int +dissect_pkixtsp_PKIFailureInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_ber_bitstring(implicit_tag, pinfo, tree, tvb, offset, + PKIFailureInfo_bits, hf_index, ett_pkixtsp_PKIFailureInfo, + NULL); + + return offset; +} +static int dissect_failInfo(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_PKIFailureInfo(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_failInfo); +} + +static const ber_sequence PKIStatusInfo_sequence[] = { + { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_pki_status }, + { BER_CLASS_UNI, BER_UNI_TAG_BITSTRING, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_failInfo }, + { 0, 0, 0, NULL } +}; + +static int +dissect_pkixtsp_PKIStatusInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset, + PKIStatusInfo_sequence, hf_index, ett_pkixtsp_PKIStatusInfo); + + return offset; +} +static int dissect_status(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_PKIStatusInfo(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_status); +} + + +static int +dissect_pkixtsp_TimeStampToken(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_cms_ContentInfo(implicit_tag, tvb, offset, pinfo, tree, hf_index); + + return offset; +} +static int dissect_timeStampToken(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_TimeStampToken(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_timeStampToken); +} + +static const ber_sequence TimeStampResp_sequence[] = { + { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_status }, + { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_timeStampToken }, + { 0, 0, 0, NULL } +}; + +static int +dissect_pkixtsp_TimeStampResp(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset, + TimeStampResp_sequence, hf_index, ett_pkixtsp_TimeStampResp); + + return offset; +} + + +static const value_string tst_version_vals[] = { + { 1, "v1" }, + { 0, NULL } +}; + + +static int +dissect_pkixtsp_tst_version(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_ber_integer_new(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL); + + return offset; +} +static int dissect_tst_version(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_tst_version(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_tst_version); +} + + +static int +dissect_pkixtsp_GeneralizedTime(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_ber_generalized_time(pinfo, tree, tvb, offset, hf_index); + + return offset; +} +static int dissect_genTime(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_GeneralizedTime(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_genTime); +} + + + +static int +dissect_pkixtsp_INTEGER_1_999(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_ber_integer_new(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL); + + return offset; +} +static int dissect_millis_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_INTEGER_1_999(TRUE, tvb, offset, pinfo, tree, hf_pkixtsp_millis); +} +static int dissect_micros_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_INTEGER_1_999(TRUE, tvb, offset, pinfo, tree, hf_pkixtsp_micros); +} + +static const ber_sequence Accuracy_sequence[] = { + { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_seconds }, + { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_millis_impl }, + { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_micros_impl }, + { 0, 0, 0, NULL } +}; + +static int +dissect_pkixtsp_Accuracy(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset, + Accuracy_sequence, hf_index, ett_pkixtsp_Accuracy); + + return offset; +} +static int dissect_accuracy(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { + return dissect_pkixtsp_Accuracy(FALSE, tvb, offset, pinfo, tree, hf_pkixtsp_accuracy); +} + +static const ber_sequence TSTInfo_sequence[] = { + { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_tst_version }, + { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_policy }, + { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_messageImprint }, + { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_serialNumber }, + { BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_NOOWNTAG, dissect_genTime }, + { BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_accuracy }, + { BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ordering }, + { BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_nonce }, + { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_tsa_impl }, + { BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_extensions_impl }, + { 0, 0, 0, NULL } +}; + +static int +dissect_pkixtsp_TSTInfo(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { + offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset, + TSTInfo_sequence, hf_index, ett_pkixtsp_TSTInfo); + + return offset; +} + + +/*--- End of included file: packet-pkixtsp-fn.c ---*/ + + + +static int +dissect_timestamp_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +{ + proto_item *item=NULL; + proto_tree *tree=NULL; + + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "PKIXTSP"); + + if (check_col(pinfo->cinfo, COL_INFO)) { + col_clear(pinfo->cinfo, COL_INFO); + + col_add_fstr(pinfo->cinfo, COL_INFO, "Reply"); + } + + + if(parent_tree){ + item=proto_tree_add_item(parent_tree, proto_pkixtsp, tvb, 0, -1, FALSE); + tree = proto_item_add_subtree(item, ett_pkixtsp); + } + + return dissect_pkixtsp_TimeStampResp(FALSE, tvb, 0, pinfo, tree, -1); +} + +static int +dissect_timestamp_query(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) +{ + proto_item *item=NULL; + proto_tree *tree=NULL; + + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "PKIXTSP"); + + if (check_col(pinfo->cinfo, COL_INFO)) { + col_clear(pinfo->cinfo, COL_INFO); + + col_add_fstr(pinfo->cinfo, COL_INFO, "Query"); + } + + + if(parent_tree){ + item=proto_tree_add_item(parent_tree, proto_pkixtsp, tvb, 0, -1, FALSE); + tree = proto_item_add_subtree(item, ett_pkixtsp); + } + + return dissect_pkixtsp_TimeStampReq(FALSE, tvb, 0, pinfo, tree, -1); +} + + +/*--- proto_register_pkixtsp ----------------------------------------------*/ +void proto_register_pkixtsp(void) { + + /* List of fields */ + static hf_register_info hf[] = { + +/*--- Included file: packet-pkixtsp-hfarr.c ---*/ + + { &hf_pkixtsp_version, + { "version", "pkixtsp.version", + FT_INT32, BASE_DEC, VALS(T_version_vals), 0, + "TimeStampReq/version", HFILL }}, + { &hf_pkixtsp_messageImprint, + { "messageImprint", "pkixtsp.messageImprint", + FT_NONE, BASE_NONE, NULL, 0, + "", HFILL }}, + { &hf_pkixtsp_reqPolicy, + { "reqPolicy", "pkixtsp.reqPolicy", + FT_STRING, BASE_NONE, NULL, 0, + "TimeStampReq/reqPolicy", HFILL }}, + { &hf_pkixtsp_nonce, + { "nonce", "pkixtsp.nonce", + FT_INT32, BASE_DEC, NULL, 0, + "", HFILL }}, + { &hf_pkixtsp_certReq, + { "certReq", "pkixtsp.certReq", + FT_BOOLEAN, 8, NULL, 0, + "TimeStampReq/certReq", HFILL }}, + { &hf_pkixtsp_extensions, + { "extensions", "pkixtsp.extensions", + FT_UINT32, BASE_DEC, NULL, 0, + "", HFILL }}, + { &hf_pkixtsp_hashAlgorithm, + { "hashAlgorithm", "pkixtsp.hashAlgorithm", + FT_NONE, BASE_NONE, NULL, 0, + "MessageImprint/hashAlgorithm", HFILL }}, + { &hf_pkixtsp_hashedMessage, + { "hashedMessage", "pkixtsp.hashedMessage", + FT_BYTES, BASE_HEX, NULL, 0, + "MessageImprint/hashedMessage", HFILL }}, + { &hf_pkixtsp_status, + { "status", "pkixtsp.status", + FT_NONE, BASE_NONE, NULL, 0, + "TimeStampResp/status", HFILL }}, + { &hf_pkixtsp_timeStampToken, + { "timeStampToken", "pkixtsp.timeStampToken", + FT_NONE, BASE_NONE, NULL, 0, + "TimeStampResp/timeStampToken", HFILL }}, + { &hf_pkixtsp_pki_status, + { "status", "pkixtsp.status", + FT_INT32, BASE_DEC, VALS(PKIStatus_vals), 0, + "PKIStatusInfo/status", HFILL }}, + { &hf_pkixtsp_failInfo, + { "failInfo", "pkixtsp.failInfo", + FT_BYTES, BASE_HEX, NULL, 0, + "PKIStatusInfo/failInfo", HFILL }}, + { &hf_pkixtsp_tst_version, + { "version", "pkixtsp.version", + FT_INT32, BASE_DEC, VALS(tst_version_vals), 0, + "TSTInfo/version", HFILL }}, + { &hf_pkixtsp_policy, + { "policy", "pkixtsp.policy", + FT_STRING, BASE_NONE, NULL, 0, + "TSTInfo/policy", HFILL }}, + { &hf_pkixtsp_serialNumber, + { "serialNumber", "pkixtsp.serialNumber", + FT_INT32, BASE_DEC, NULL, 0, + "TSTInfo/serialNumber", HFILL }}, + { &hf_pkixtsp_genTime, + { "genTime", "pkixtsp.genTime", + FT_STRING, BASE_NONE, NULL, 0, + "TSTInfo/genTime", HFILL }}, + { &hf_pkixtsp_accuracy, + { "accuracy", "pkixtsp.accuracy", + FT_NONE, BASE_NONE, NULL, 0, + "TSTInfo/accuracy", HFILL }}, + { &hf_pkixtsp_ordering, + { "ordering", "pkixtsp.ordering", + FT_BOOLEAN, 8, NULL, 0, + "TSTInfo/ordering", HFILL }}, + { &hf_pkixtsp_tsa, + { "tsa", "pkixtsp.tsa", + FT_UINT32, BASE_DEC, NULL, 0, + "TSTInfo/tsa", HFILL }}, + { &hf_pkixtsp_seconds, + { "seconds", "pkixtsp.seconds", + FT_INT32, BASE_DEC, NULL, 0, + "Accuracy/seconds", HFILL }}, + { &hf_pkixtsp_millis, + { "millis", "pkixtsp.millis", + FT_UINT32, BASE_DEC, NULL, 0, + "Accuracy/millis", HFILL }}, + { &hf_pkixtsp_micros, + { "micros", "pkixtsp.micros", + FT_UINT32, BASE_DEC, NULL, 0, + "Accuracy/micros", HFILL }}, + { &hf_pkixtsp_PKIFailureInfo_badAlg, + { "badAlg", "pkixtsp.badAlg", + FT_BOOLEAN, 8, NULL, 0x80, + "", HFILL }}, + { &hf_pkixtsp_PKIFailureInfo_badRequest, + { "badRequest", "pkixtsp.badRequest", + FT_BOOLEAN, 8, NULL, 0x20, + "", HFILL }}, + { &hf_pkixtsp_PKIFailureInfo_badDataFormat, + { "badDataFormat", "pkixtsp.badDataFormat", + FT_BOOLEAN, 8, NULL, 0x04, + "", HFILL }}, + { &hf_pkixtsp_PKIFailureInfo_timeNotAvailable, + { "timeNotAvailable", "pkixtsp.timeNotAvailable", + FT_BOOLEAN, 8, NULL, 0x02, + "", HFILL }}, + { &hf_pkixtsp_PKIFailureInfo_unacceptedPolicy, + { "unacceptedPolicy", "pkixtsp.unacceptedPolicy", + FT_BOOLEAN, 8, NULL, 0x01, + "", HFILL }}, + { &hf_pkixtsp_PKIFailureInfo_unacceptedExtension, + { "unacceptedExtension", "pkixtsp.unacceptedExtension", + FT_BOOLEAN, 8, NULL, 0x80, + "", HFILL }}, + { &hf_pkixtsp_PKIFailureInfo_addInfoNotAvailable, + { "addInfoNotAvailable", "pkixtsp.addInfoNotAvailable", + FT_BOOLEAN, 8, NULL, 0x40, + "", HFILL }}, + { &hf_pkixtsp_PKIFailureInfo_systemFailure, + { "systemFailure", "pkixtsp.systemFailure", + FT_BOOLEAN, 8, NULL, 0x40, + "", HFILL }}, + +/*--- End of included file: packet-pkixtsp-hfarr.c ---*/ + + }; + + /* List of subtrees */ + static gint *ett[] = { + &ett_pkixtsp, + +/*--- Included file: packet-pkixtsp-ettarr.c ---*/ + + &ett_pkixtsp_TimeStampReq, + &ett_pkixtsp_MessageImprint, + &ett_pkixtsp_TimeStampResp, + &ett_pkixtsp_PKIStatusInfo, + &ett_pkixtsp_PKIFailureInfo, + &ett_pkixtsp_TSTInfo, + &ett_pkixtsp_Accuracy, + +/*--- End of included file: packet-pkixtsp-ettarr.c ---*/ + + }; + + /* Register protocol */ + proto_pkixtsp = proto_register_protocol(PNAME, PSNAME, PFNAME); + + /* Register fields and subtrees */ + proto_register_field_array(proto_pkixtsp, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); + +} + + +/*--- proto_reg_handoff_pkixtsp -------------------------------------------*/ +void proto_reg_handoff_pkixtsp(void) { + dissector_handle_t timestamp_reply_handle; + dissector_handle_t timestamp_query_handle; + + timestamp_reply_handle = new_create_dissector_handle(dissect_timestamp_reply, proto_pkixtsp); + dissector_add_string("media_type", "application/timestamp-reply", timestamp_reply_handle); + + timestamp_query_handle = new_create_dissector_handle(dissect_timestamp_query, proto_pkixtsp); + dissector_add_string("media_type", "application/timestamp-query", timestamp_query_handle); + +/*#include "packet-pkixtsp-dis-tab.c"*/ +} + diff --git a/epan/dissectors/packet-pkixtsp.h b/epan/dissectors/packet-pkixtsp.h new file mode 100644 index 0000000000..53164d80a6 --- /dev/null +++ b/epan/dissectors/packet-pkixtsp.h @@ -0,0 +1,39 @@ +/* Do not modify this file. */ +/* It is created automatically by the ASN.1 to Ethereal dissector compiler */ +/* ./packet-pkixtsp.h */ +/* ../../tools/asn2eth.py -X -b -k -e -p pkixtsp -c pkixtsp.cnf -s packet-pkixtsp-template PKIXTSP.asn */ + +/* Input file: packet-pkixtsp-template.h */ + +/* packet-pkixtsp.h + * Routines for RFC3161 Time-Stamp Protocol packet dissection + * Ronnie Sahlberg 2004 + * + * $Id: packet-pkixtsp-template.h 12437 2004-10-30 02:18:44Z sahlberg $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * Copyright 1998 Gerald Combs + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef PACKET_PKIXTSP_H +#define PACKET_PKIXTSP_H + +/*#include "packet-pkixtsp-exp.h"*/ + +#endif /* PACKET_PKIXTSP_H */ + |