summaryrefslogtreecommitdiff
path: root/asn1/x509af/x509af.cnf
blob: 1b173f05137688c3e064cf18427cb556b80b85ee (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# x509.cnf
# X509 conformation file

#.IMPORT ../x509ce/x509ce-exp.cnf
#.IMPORT ../x509if/x509if-exp.cnf
#.IMPORT ../x509sat/x509sat-exp.cnf

#.MODULE_EXPORTS
EXTENSION
ACPathData
AlgorithmIdentifier
AttCertValidityPeriod
AttributeCertificate
AttributeCertificateAssertion
AttributeCertificateInfo
AttributeCertificationPath
Certificate
Certificate_PDU
Certificates
CertificateList
CertificatePair
CertificateSerialNumber
CertificationPath
CrossCertificates
Extension
Extensions
ForwardCertificationPath
IssuerSerial
SubjectPublicKeyInfo
Time
Validity
Version

#.PDU_NEW

#.REGISTER_NEW
Certificate				B "2.5.4.36" "id-at-userCertificate"
Certificate				B "2.5.4.37" "id-at-cAcertificate"
CertificateList			B "2.5.4.38" "id-at-authorityRevocationList"
CertificateList			B "2.5.4.39" "id-at-certificateRevocationList"
CertificatePair			B "2.5.4.40" "id-at-crossCertificatePair"
CertificateList			B "2.5.4.53" "id-at-deltaRevocationList"
AttributeCertificate	B "2.5.4.58" "id-at-attributeCertificate"
CertificateList			B "2.5.4.59" "id-at-attributeCertificateRevocationList"

DSS-Params				B "1.2.840.10040.4.1" "id-dsa"

#.TYPE_RENAME
AttributeCertificateInfo/subject	InfoSubject
AttributeCertificateAssertion/subject	AssertionSubject

#.FIELD_RENAME
AttributeCertificateInfo/issuer		issuerName
AttributeCertificateInfo/subject info_subject
AttributeCertificateAssertion/subject assertion_subject

AttributeCertificateAssertion/issuer assertionIssuer

AttributeCertificateInfo/subject/subjectName      infoSubjectName
AttributeCertificateAssertion/subject/subjectName assertionSubjectName
IssuerSerial/issuer			issuerName
CertificateList/signedCertificateList/revokedCertificates/_item/userCertificate		revokedUserCertificate
#.END

#.FN_PARS AlgorithmIdentifier/algorithmId
  FN_VARIANT = _str  HF_INDEX = hf_x509af_algorithm_id  VAL_PTR = &actx->external.direct_reference

#.FN_BODY AlgorithmIdentifier/algorithmId
  const char *name;

  %(DEFAULT_BODY)s

  algorithm_id = actx->external.direct_reference;

  if(actx->external.direct_reference) {
    name = oid_resolved_from_string(wmem_packet_scope(), actx->external.direct_reference);

    proto_item_append_text(tree, " (%%s)", name ? name : actx->external.direct_reference);
  }

#.FN_BODY AlgorithmIdentifier/parameters
  offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL);

#.FN_BODY SubjectPublicKeyInfo/subjectPublicKey
  tvbuff_t *bs_tvb;

  /* subjectPublicKey is a BIT STRING with an explicit tag. It is DER-encoded,
   * meaning that the length field consists of hex 8n followed by n octets. */
  /* TODO: drop dissect_ber_bitstring and use above assumptions? */
  /* -1 for hf_index and NULL for tree as this only attempts to parse the
   * bitstring without creating a tree, */
  dissect_ber_bitstring(FALSE, actx, NULL, tvb, offset,
                        NULL, -1, -1, &bs_tvb);

  /* See RFC 3279 for possible subjectPublicKey values given an Algorithm ID.
   * The contents of subjectPublicKey are always explicitly tagged. */

  if (!strcmp(algorithm_id, "1.2.840.113549.1.1.1")) { /* id-rsa */
    offset += dissect_pkcs1_RSAPublicKey(FALSE, bs_tvb, 0, actx, tree, hf_index);

  } else if (!strcmp(algorithm_id, "1.2.840.10040.4.1")) { /* id-dsa */
    offset += dissect_pkcs1_DSAPublicKey(FALSE, bs_tvb, 0, actx, tree, hf_index);

  } else if (!strcmp(algorithm_id, "1.2.840.10046.2.1")) { /* dhpublicnumber */
    offset += dissect_pkcs1_DHPublicKey(FALSE, bs_tvb, 0, actx, tree, hf_index);

  } else {
    /* unknown key type, display raw contents. */
    offset = dissect_ber_bitstring(FALSE, actx, tree, tvb, offset,
                                   NULL, hf_index, -1, NULL);
  }

#.FN_PARS Extension/extnId
  FN_VARIANT = _str  HF_INDEX = hf_x509af_extension_id  VAL_PTR = &actx->external.direct_reference

#.FN_BODY Extension/extnId
  const char *name;

  %(DEFAULT_BODY)s

  if(actx->external.direct_reference) {
    name = oid_resolved_from_string(wmem_packet_scope(), actx->external.direct_reference);

    proto_item_append_text(tree, " (%%s)", name ? name : actx->external.direct_reference);
  }

#.FN_BODY Extension/extnValue
  gint8 ber_class;
  gboolean pc, ind;
  gint32 tag;
  guint32 len;
  /* skip past the T and L  */
  offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &ber_class, &pc, &tag);
  offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, &ind);
  offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL);

#.FN_BODY SubjectName

  const char* str;
  %(DEFAULT_BODY)s

  str = x509if_get_last_dn();
  proto_item_append_text(proto_item_get_parent(tree), " (%%s)", str?str:"");

#.TYPE_ATTR
CertificateSerialNumber TYPE = FT_INT64

#.FN_PARS CertificateSerialNumber FN_VARIANT = 64

#.END