aboutsummaryrefslogtreecommitdiffstats
path: root/asn1/cms/cms.cnf
blob: 5414cc51a4f33b60ace9b6ade8d86fc54e1ea768 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# CMS.cnf
# CMS conformation file

# $Id$

#.MODULE_IMPORT
AuthenticationFramework x509af
InformationFramework x509if

#.INCLUDE ../x509af/x509af-exp.cnf
#.INCLUDE ../x509if/x509if-exp.cnf

#.EXPORTS
ContentInfo
ContentType
Countersignature
DigestAlgorithmIdentifiers
EncapsulatedContentInfo
EnvelopedData
IssuerAndSerialNumber
SignedAttributes
SignedData
SignerIdentifier
SignerInfo
SignerInfos
SignatureValue
UnsignedAttributes

#.REGISTER
ContentInfo       B "1.2.840.113549.1.9.16.1.6" "id-ct-contentInfo"
SignedData        B "1.2.840.113549.1.7.2"      "id-signedData"
EnvelopedData     B "1.2.840.113549.1.7.3"      "id-envelopedData"
DigestedData      B "1.2.840.113549.1.7.5"      "id-digestedData"
EncryptedData     B "1.2.840.113549.1.7.6"      "id-encryptedData"
AuthenticatedData B "1.2.840.113549.1.9.16.1.2" "id-ct-authenticatedData"

ContentType		  B "1.2.840.113549.1.9.3"	"id-contentType"
MessageDigest	  B "1.2.840.113549.1.9.4"	"id-messageDigest"
SigningTime		  B "1.2.840.113549.1.9.5"	"id-signingTime"
Countersignature  B "1.2.840.113549.1.9.6"	"id-counterSignature"

ContentInfo	 B "2.6.1.4.18" "id-et-pkcs7"

#.NO_EMIT

#.TYPE_RENAME

#.FIELD_RENAME
SignerInfo/signature	signatureValue
RecipientEncryptedKey/rid	rekRid
EncryptedContentInfo/contentType	encryptedContentType

#.FN_BODY ContentInfo
  top_tree = tree;
  %(DEFAULT_BODY)s
  content_tvb = NULL;
  top_tree = NULL;

#.FN_BODY ContentInfo/contentType
  offset = dissect_ber_object_identifier_str(FALSE, pinfo, tree, tvb, offset,
                                         hf_cms_ci_contentType, &object_identifier_id);

#.FN_BODY ContentInfo/content
  offset=call_ber_oid_callback(object_identifier_id, tvb, offset, pinfo, tree);

#.FN_BODY EncapsulatedContentInfo/eContentType
  offset = dissect_ber_object_identifier_str(FALSE, pinfo, tree, tvb, offset,
                                         hf_cms_ci_contentType, &object_identifier_id);

#.FN_BODY EncapsulatedContentInfo/eContent
  gint8 class;
  gboolean pc, ind;
  gint32 tag;
  guint32 len;
  int pdu_offset = offset;
  int content_offset;

  /* XXX Do we care about printing out the octet string? */
  offset = dissect_cms_OCTET_STRING(FALSE, tvb, offset, pinfo, NULL, hf_cms_eContent);

  pdu_offset = get_ber_identifier(tvb, pdu_offset, &class, &pc, &tag);
  content_offset = pdu_offset = get_ber_length(tree, tvb, pdu_offset, &len, &ind);
  pdu_offset = call_ber_oid_callback(object_identifier_id, tvb, pdu_offset, pinfo, top_tree ? top_tree : tree);
  
  content_tvb = tvb_new_subset(tvb, content_offset, len, -1);

#.FN_PARS OtherKeyAttribute/keyAttrId
  FN_VARIANT = _str  HF_INDEX = hf_cms_ci_contentType  VAL_PTR = &object_identifier_id

#.FN_BODY OtherKeyAttribute/keyAttr
  offset=call_ber_oid_callback(object_identifier_id, tvb, offset, pinfo, tree);


#.FN_PARS Attribute/attrType
  FN_VARIANT = _str  HF_INDEX = hf_cms_attrType  VAL_PTR = &object_identifier_id

#.FN_BODY Attribute/attrType
  const char *name = NULL;

  %(DEFAULT_BODY)s

  if(object_identifier_id) {
    name = get_ber_oid_name(object_identifier_id);
    proto_item_append_text(tree, " (%%s)", name ? name : object_identifier_id); 
  }

#.FN_BODY AttributeValue

  offset=call_ber_oid_callback(object_identifier_id, tvb, offset, pinfo, tree);

#.FN_BODY MessageDigest
  proto_item *pi;
  int old_offset = offset;

  %(DEFAULT_BODY)s
 
  pi = get_ber_last_created_item();

  /* move past TLV */
  old_offset = get_ber_identifier(tvb, old_offset, NULL, NULL, NULL);
  old_offset = get_ber_length(tree, tvb, old_offset, NULL, NULL);

  if(content_tvb) 
    cms_verify_msg_digest(pi, content_tvb, x509af_get_last_algorithm_id(), tvb, old_offset);

#.END