]>
Commit | Line | Data |
---|---|---|
29654253 A |
1 | // NOTE: this is a machine generated file--editing not recommended |
2 | // | |
3 | // pkcs10.cpp - class member functions for ASN.1 module PKCS5 | |
4 | // | |
5 | // This file was generated by snacc on Mon Apr 22 22:34:19 2002 | |
6 | // UBC snacc written by Mike Sample | |
7 | // A couple of enhancements made by IBM European Networking Center | |
8 | ||
9 | ||
10 | #include "asn-incl.h" | |
11 | #include "sm_vdatypes.h" | |
12 | #include "sm_x501ud.h" | |
13 | #include "sm_x411ub.h" | |
14 | #include "sm_x411mtsas.h" | |
15 | #include "sm_x501if.h" | |
16 | #include "sm_x520sa.h" | |
17 | #include "sm_x509cmn.h" | |
18 | #include "sm_x509af.h" | |
19 | #include "sm_x509ce.h" | |
20 | #include "pkcs1oids.h" | |
21 | #include "pkcs9oids.h" | |
22 | #include "sm_cms.h" | |
23 | #include "sm_ess.h" | |
24 | #include "pkcs7.h" | |
25 | #include "pkcs8.h" | |
26 | #include "appleoids.h" | |
27 | #include "pkcs10.h" | |
28 | ||
29 | //------------------------------------------------------------------------------ | |
30 | // value defs | |
31 | ||
32 | ||
33 | //------------------------------------------------------------------------------ | |
34 | // class member definitions: | |
35 | ||
36 | CertificationRequestInfo::CertificationRequestInfo() | |
37 | { | |
38 | #if TCL | |
39 | subject = new Name; | |
40 | #else | |
41 | subject = NULL; // incomplete initialization of mandatory element! | |
42 | #endif // TCL | |
43 | #if TCL | |
44 | subjectPublicKeyInfo = new SubjectPublicKeyInfo; | |
45 | #else | |
46 | subjectPublicKeyInfo = NULL; // incomplete initialization of mandatory element! | |
47 | #endif // TCL | |
48 | } | |
49 | ||
50 | CertificationRequestInfo::CertificationRequestInfo (const CertificationRequestInfo &) | |
51 | { | |
52 | Asn1Error << "use of incompletely defined CertificationRequestInfo::CertificationRequestInfo (const CertificationRequestInfo &)" << endl; | |
53 | abort(); | |
54 | } | |
55 | ||
56 | CertificationRequestInfo::~CertificationRequestInfo() | |
57 | { | |
58 | delete subject; | |
59 | delete subjectPublicKeyInfo; | |
60 | } | |
61 | ||
62 | AsnType *CertificationRequestInfo::Clone() const | |
63 | { | |
64 | return new CertificationRequestInfo; | |
65 | } | |
66 | ||
67 | AsnType *CertificationRequestInfo::Copy() const | |
68 | { | |
69 | return new CertificationRequestInfo (*this); | |
70 | } | |
71 | ||
72 | #if SNACC_DEEP_COPY | |
73 | CertificationRequestInfo &CertificationRequestInfo::operator = (const CertificationRequestInfo &that) | |
74 | #else // SNACC_DEEP_COPY | |
75 | CertificationRequestInfo &CertificationRequestInfo::operator = (const CertificationRequestInfo &) | |
76 | #endif // SNACC_DEEP_COPY | |
77 | { | |
78 | #if SNACC_DEEP_COPY | |
79 | if (this != &that) | |
80 | { | |
81 | version = that.version; | |
82 | if (that.subject) | |
83 | { | |
84 | if (!subject) | |
85 | subject = new Name; | |
86 | *subject = *that.subject; | |
87 | } | |
88 | else | |
89 | { | |
90 | delete subject; | |
91 | subject = NULL; | |
92 | } | |
93 | if (that.subjectPublicKeyInfo) | |
94 | { | |
95 | if (!subjectPublicKeyInfo) | |
96 | subjectPublicKeyInfo = new SubjectPublicKeyInfo; | |
97 | *subjectPublicKeyInfo = *that.subjectPublicKeyInfo; | |
98 | } | |
99 | else | |
100 | { | |
101 | delete subjectPublicKeyInfo; | |
102 | subjectPublicKeyInfo = NULL; | |
103 | } | |
104 | attributes = that.attributes; | |
105 | } | |
106 | ||
107 | return *this; | |
108 | #else // SNACC_DEEP_COPY | |
109 | Asn1Error << "use of incompletely defined CertificationRequestInfo &CertificationRequestInfo::operator = (const CertificationRequestInfo &)" << endl; | |
110 | abort(); | |
111 | // if your compiler complains here, check the -novolat option | |
112 | #endif // SNACC_DEEP_COPY | |
113 | } | |
114 | ||
115 | AsnLen | |
116 | CertificationRequestInfo::BEncContent (BUF_TYPE b) | |
117 | { | |
118 | AsnLen totalLen = 0; | |
119 | AsnLen l; | |
120 | ||
121 | BEncEocIfNec (b); | |
122 | l = attributes.BEncContent (b); | |
123 | l += BEncConsLen (b, l); | |
124 | ||
125 | l += BEncTag1 (b, CNTX, CONS, 0); | |
126 | totalLen += l; | |
127 | ||
128 | BEncEocIfNec (b); | |
129 | l = subjectPublicKeyInfo->BEncContent (b); | |
130 | l += BEncConsLen (b, l); | |
131 | ||
132 | l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); | |
133 | totalLen += l; | |
134 | ||
135 | l = subject->BEncContent (b); | |
136 | totalLen += l; | |
137 | ||
138 | l = version.BEncContent (b); | |
139 | BEncDefLenTo127 (b, l); | |
140 | l++; | |
141 | ||
142 | l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE); | |
143 | totalLen += l; | |
144 | ||
145 | return totalLen; | |
146 | } // CertificationRequestInfo::BEncContent | |
147 | ||
148 | ||
149 | void CertificationRequestInfo::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env) | |
150 | { | |
151 | AsnTag tag1; | |
152 | AsnLen seqBytesDecoded = 0; | |
153 | AsnLen elmtLen1; | |
154 | tag1 = BDecTag (b, seqBytesDecoded, env); | |
155 | ||
156 | if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))) | |
157 | { | |
158 | elmtLen1 = BDecLen (b, seqBytesDecoded, env); | |
159 | version.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); | |
160 | tag1 = BDecTag (b, seqBytesDecoded, env); | |
161 | } | |
162 | else | |
163 | { | |
164 | Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; | |
165 | SnaccExcep::throwMe(-100); | |
166 | } | |
167 | ||
168 | if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))) | |
169 | { | |
170 | elmtLen1 = BDecLen (b, seqBytesDecoded, env); | |
171 | subject = new Name; | |
172 | subject->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); | |
173 | tag1 = BDecTag (b, seqBytesDecoded, env); | |
174 | } | |
175 | else | |
176 | { | |
177 | Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; | |
178 | SnaccExcep::throwMe(-101); | |
179 | } | |
180 | ||
181 | if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))) | |
182 | { | |
183 | elmtLen1 = BDecLen (b, seqBytesDecoded, env); | |
184 | subjectPublicKeyInfo = new SubjectPublicKeyInfo; | |
185 | subjectPublicKeyInfo->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); | |
186 | tag1 = BDecTag (b, seqBytesDecoded, env); | |
187 | } | |
188 | else | |
189 | { | |
190 | Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; | |
191 | SnaccExcep::throwMe(-102); | |
192 | } | |
193 | ||
194 | if ((tag1 == MAKE_TAG_ID (CNTX, CONS, 0))) | |
195 | { | |
196 | elmtLen1 = BDecLen (b, seqBytesDecoded, env); | |
197 | attributes.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); | |
198 | } | |
199 | else | |
200 | { | |
201 | Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; | |
202 | SnaccExcep::throwMe(-103); | |
203 | } | |
204 | ||
205 | bytesDecoded += seqBytesDecoded; | |
206 | if (elmtLen0 == INDEFINITE_LEN) | |
207 | { | |
208 | BDecEoc (b, bytesDecoded, env); | |
209 | return; | |
210 | } | |
211 | else if (seqBytesDecoded != elmtLen0) | |
212 | { | |
213 | Asn1Error << "ERROR - Length discrepancy on sequence." << endl; | |
214 | SnaccExcep::throwMe(-104); | |
215 | } | |
216 | else | |
217 | return; | |
218 | } // CertificationRequestInfo::BDecContent | |
219 | ||
220 | AsnLen CertificationRequestInfo::BEnc (BUF_TYPE b) | |
221 | { | |
222 | AsnLen l; | |
223 | l = BEncContent (b); | |
224 | l += BEncConsLen (b, l); | |
225 | l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); | |
226 | return l; | |
227 | } | |
228 | ||
229 | void CertificationRequestInfo::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env) | |
230 | { | |
231 | AsnTag tag; | |
232 | AsnLen elmtLen1; | |
233 | ||
234 | if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)) | |
235 | { | |
236 | Asn1Error << "CertificationRequestInfo::BDec: ERROR - wrong tag" << endl; | |
237 | SnaccExcep::throwMe(-105); | |
238 | } | |
239 | elmtLen1 = BDecLen (b, bytesDecoded, env); | |
240 | BDecContent (b, tag, elmtLen1, bytesDecoded, env); | |
241 | } | |
242 | ||
243 | void CertificationRequestInfo::Print (ostream &os) const | |
244 | { | |
245 | #ifndef NDEBUG | |
246 | os << "{ -- SEQUENCE --" << endl; | |
247 | indentG += stdIndentG; | |
248 | ||
249 | { | |
250 | Indent (os, indentG); | |
251 | os << "version "; | |
252 | os << version; | |
253 | os << "," << endl; | |
254 | } | |
255 | ||
256 | if (NOT_NULL (subject)) | |
257 | { | |
258 | Indent (os, indentG); | |
259 | os << "subject "; | |
260 | os << *subject; | |
261 | } | |
262 | else | |
263 | { | |
264 | Indent (os, indentG); | |
265 | os << "subject "; | |
266 | os << "-- void --"; | |
267 | os << "," << endl; | |
268 | } | |
269 | ||
270 | if (NOT_NULL (subjectPublicKeyInfo)) | |
271 | { | |
272 | Indent (os, indentG); | |
273 | os << "subjectPublicKeyInfo "; | |
274 | os << *subjectPublicKeyInfo; | |
275 | } | |
276 | else | |
277 | { | |
278 | Indent (os, indentG); | |
279 | os << "subjectPublicKeyInfo "; | |
280 | os << "-- void --"; | |
281 | os << "," << endl; | |
282 | } | |
283 | ||
284 | { | |
285 | Indent (os, indentG); | |
286 | os << "attributes "; | |
287 | os << attributes; | |
288 | } | |
289 | ||
290 | os << endl; | |
291 | indentG -= stdIndentG; | |
292 | Indent (os, indentG); | |
293 | os << "}"; | |
294 | #endif /* NDEBUG */ | |
295 | } // CertificationRequestInfo::Print | |
296 | ||
297 | ||
298 | CertificationRequest::CertificationRequest() | |
299 | { | |
300 | #if TCL | |
301 | certificationRequestInfo = new CertificationRequestInfo; | |
302 | #else | |
303 | certificationRequestInfo = NULL; // incomplete initialization of mandatory element! | |
304 | #endif // TCL | |
305 | #if TCL | |
306 | signatureAlgorithm = new SignatureAlgorithmIdentifier; | |
307 | #else | |
308 | signatureAlgorithm = NULL; // incomplete initialization of mandatory element! | |
309 | #endif // TCL | |
310 | } | |
311 | ||
312 | CertificationRequest::CertificationRequest (const CertificationRequest &) | |
313 | { | |
314 | Asn1Error << "use of incompletely defined CertificationRequest::CertificationRequest (const CertificationRequest &)" << endl; | |
315 | abort(); | |
316 | } | |
317 | ||
318 | CertificationRequest::~CertificationRequest() | |
319 | { | |
320 | delete certificationRequestInfo; | |
321 | delete signatureAlgorithm; | |
322 | } | |
323 | ||
324 | AsnType *CertificationRequest::Clone() const | |
325 | { | |
326 | return new CertificationRequest; | |
327 | } | |
328 | ||
329 | AsnType *CertificationRequest::Copy() const | |
330 | { | |
331 | return new CertificationRequest (*this); | |
332 | } | |
333 | ||
334 | #if SNACC_DEEP_COPY | |
335 | CertificationRequest &CertificationRequest::operator = (const CertificationRequest &that) | |
336 | #else // SNACC_DEEP_COPY | |
337 | CertificationRequest &CertificationRequest::operator = (const CertificationRequest &) | |
338 | #endif // SNACC_DEEP_COPY | |
339 | { | |
340 | #if SNACC_DEEP_COPY | |
341 | if (this != &that) | |
342 | { | |
343 | if (that.certificationRequestInfo) | |
344 | { | |
345 | if (!certificationRequestInfo) | |
346 | certificationRequestInfo = new CertificationRequestInfo; | |
347 | *certificationRequestInfo = *that.certificationRequestInfo; | |
348 | } | |
349 | else | |
350 | { | |
351 | delete certificationRequestInfo; | |
352 | certificationRequestInfo = NULL; | |
353 | } | |
354 | if (that.signatureAlgorithm) | |
355 | { | |
356 | if (!signatureAlgorithm) | |
357 | signatureAlgorithm = new SignatureAlgorithmIdentifier; | |
358 | *signatureAlgorithm = *that.signatureAlgorithm; | |
359 | } | |
360 | else | |
361 | { | |
362 | delete signatureAlgorithm; | |
363 | signatureAlgorithm = NULL; | |
364 | } | |
365 | signature = that.signature; | |
366 | } | |
367 | ||
368 | return *this; | |
369 | #else // SNACC_DEEP_COPY | |
370 | Asn1Error << "use of incompletely defined CertificationRequest &CertificationRequest::operator = (const CertificationRequest &)" << endl; | |
371 | abort(); | |
372 | // if your compiler complains here, check the -novolat option | |
373 | #endif // SNACC_DEEP_COPY | |
374 | } | |
375 | ||
376 | AsnLen | |
377 | CertificationRequest::BEncContent (BUF_TYPE b) | |
378 | { | |
379 | AsnLen totalLen = 0; | |
380 | AsnLen l; | |
381 | ||
382 | l = signature.BEncContent (b); | |
383 | l += BEncDefLen (b, l); | |
384 | ||
385 | l += BEncTag1 (b, UNIV, PRIM, BITSTRING_TAG_CODE); | |
386 | totalLen += l; | |
387 | ||
388 | BEncEocIfNec (b); | |
389 | l = signatureAlgorithm->BEncContent (b); | |
390 | l += BEncConsLen (b, l); | |
391 | ||
392 | l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); | |
393 | totalLen += l; | |
394 | ||
395 | BEncEocIfNec (b); | |
396 | l = certificationRequestInfo->BEncContent (b); | |
397 | l += BEncConsLen (b, l); | |
398 | ||
399 | l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); | |
400 | totalLen += l; | |
401 | ||
402 | return totalLen; | |
403 | } // CertificationRequest::BEncContent | |
404 | ||
405 | ||
406 | void CertificationRequest::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env) | |
407 | { | |
408 | AsnTag tag1; | |
409 | AsnLen seqBytesDecoded = 0; | |
410 | AsnLen elmtLen1; | |
411 | tag1 = BDecTag (b, seqBytesDecoded, env); | |
412 | ||
413 | if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))) | |
414 | { | |
415 | elmtLen1 = BDecLen (b, seqBytesDecoded, env); | |
416 | certificationRequestInfo = new CertificationRequestInfo; | |
417 | certificationRequestInfo->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); | |
418 | tag1 = BDecTag (b, seqBytesDecoded, env); | |
419 | } | |
420 | else | |
421 | { | |
422 | Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; | |
423 | SnaccExcep::throwMe(-106); | |
424 | } | |
425 | ||
426 | if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))) | |
427 | { | |
428 | elmtLen1 = BDecLen (b, seqBytesDecoded, env); | |
429 | signatureAlgorithm = new SignatureAlgorithmIdentifier; | |
430 | signatureAlgorithm->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); | |
431 | tag1 = BDecTag (b, seqBytesDecoded, env); | |
432 | } | |
433 | else | |
434 | { | |
435 | Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; | |
436 | SnaccExcep::throwMe(-107); | |
437 | } | |
438 | ||
439 | if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, BITSTRING_TAG_CODE)) | |
440 | || (tag1 == MAKE_TAG_ID (UNIV, CONS, BITSTRING_TAG_CODE))) | |
441 | { | |
442 | elmtLen1 = BDecLen (b, seqBytesDecoded, env); | |
443 | signature.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); | |
444 | } | |
445 | else | |
446 | { | |
447 | Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; | |
448 | SnaccExcep::throwMe(-108); | |
449 | } | |
450 | ||
451 | bytesDecoded += seqBytesDecoded; | |
452 | if (elmtLen0 == INDEFINITE_LEN) | |
453 | { | |
454 | BDecEoc (b, bytesDecoded, env); | |
455 | return; | |
456 | } | |
457 | else if (seqBytesDecoded != elmtLen0) | |
458 | { | |
459 | Asn1Error << "ERROR - Length discrepancy on sequence." << endl; | |
460 | SnaccExcep::throwMe(-109); | |
461 | } | |
462 | else | |
463 | return; | |
464 | } // CertificationRequest::BDecContent | |
465 | ||
466 | AsnLen CertificationRequest::BEnc (BUF_TYPE b) | |
467 | { | |
468 | AsnLen l; | |
469 | l = BEncContent (b); | |
470 | l += BEncConsLen (b, l); | |
471 | l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); | |
472 | return l; | |
473 | } | |
474 | ||
475 | void CertificationRequest::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env) | |
476 | { | |
477 | AsnTag tag; | |
478 | AsnLen elmtLen1; | |
479 | ||
480 | if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)) | |
481 | { | |
482 | Asn1Error << "CertificationRequest::BDec: ERROR - wrong tag" << endl; | |
483 | SnaccExcep::throwMe(-110); | |
484 | } | |
485 | elmtLen1 = BDecLen (b, bytesDecoded, env); | |
486 | BDecContent (b, tag, elmtLen1, bytesDecoded, env); | |
487 | } | |
488 | ||
489 | void CertificationRequest::Print (ostream &os) const | |
490 | { | |
491 | #ifndef NDEBUG | |
492 | os << "{ -- SEQUENCE --" << endl; | |
493 | indentG += stdIndentG; | |
494 | ||
495 | if (NOT_NULL (certificationRequestInfo)) | |
496 | { | |
497 | Indent (os, indentG); | |
498 | os << "certificationRequestInfo "; | |
499 | os << *certificationRequestInfo; | |
500 | } | |
501 | else | |
502 | { | |
503 | Indent (os, indentG); | |
504 | os << "certificationRequestInfo "; | |
505 | os << "-- void --"; | |
506 | os << "," << endl; | |
507 | } | |
508 | ||
509 | if (NOT_NULL (signatureAlgorithm)) | |
510 | { | |
511 | Indent (os, indentG); | |
512 | os << "signatureAlgorithm "; | |
513 | os << *signatureAlgorithm; | |
514 | } | |
515 | else | |
516 | { | |
517 | Indent (os, indentG); | |
518 | os << "signatureAlgorithm "; | |
519 | os << "-- void --"; | |
520 | os << "," << endl; | |
521 | } | |
522 | ||
523 | { | |
524 | Indent (os, indentG); | |
525 | os << "signature "; | |
526 | os << signature; | |
527 | } | |
528 | ||
529 | os << endl; | |
530 | indentG -= stdIndentG; | |
531 | Indent (os, indentG); | |
532 | os << "}"; | |
533 | #endif /* NDEBUG */ | |
534 | } // CertificationRequest::Print | |
535 | ||
536 | ||
537 | CertificationRequestSigned::CertificationRequestSigned() | |
538 | { | |
539 | #if TCL | |
540 | signatureAlgorithm = new SignatureAlgorithmIdentifier; | |
541 | #else | |
542 | signatureAlgorithm = NULL; // incomplete initialization of mandatory element! | |
543 | #endif // TCL | |
544 | } | |
545 | ||
546 | CertificationRequestSigned::CertificationRequestSigned (const CertificationRequestSigned &) | |
547 | { | |
548 | Asn1Error << "use of incompletely defined CertificationRequestSigned::CertificationRequestSigned (const CertificationRequestSigned &)" << endl; | |
549 | abort(); | |
550 | } | |
551 | ||
552 | CertificationRequestSigned::~CertificationRequestSigned() | |
553 | { | |
554 | delete signatureAlgorithm; | |
555 | } | |
556 | ||
557 | AsnType *CertificationRequestSigned::Clone() const | |
558 | { | |
559 | return new CertificationRequestSigned; | |
560 | } | |
561 | ||
562 | AsnType *CertificationRequestSigned::Copy() const | |
563 | { | |
564 | return new CertificationRequestSigned (*this); | |
565 | } | |
566 | ||
567 | #if SNACC_DEEP_COPY | |
568 | CertificationRequestSigned &CertificationRequestSigned::operator = (const CertificationRequestSigned &that) | |
569 | #else // SNACC_DEEP_COPY | |
570 | CertificationRequestSigned &CertificationRequestSigned::operator = (const CertificationRequestSigned &) | |
571 | #endif // SNACC_DEEP_COPY | |
572 | { | |
573 | #if SNACC_DEEP_COPY | |
574 | if (this != &that) | |
575 | { | |
576 | certificationRequestInfo = that.certificationRequestInfo; | |
577 | if (that.signatureAlgorithm) | |
578 | { | |
579 | if (!signatureAlgorithm) | |
580 | signatureAlgorithm = new SignatureAlgorithmIdentifier; | |
581 | *signatureAlgorithm = *that.signatureAlgorithm; | |
582 | } | |
583 | else | |
584 | { | |
585 | delete signatureAlgorithm; | |
586 | signatureAlgorithm = NULL; | |
587 | } | |
588 | signature = that.signature; | |
589 | } | |
590 | ||
591 | return *this; | |
592 | #else // SNACC_DEEP_COPY | |
593 | Asn1Error << "use of incompletely defined CertificationRequestSigned &CertificationRequestSigned::operator = (const CertificationRequestSigned &)" << endl; | |
594 | abort(); | |
595 | // if your compiler complains here, check the -novolat option | |
596 | #endif // SNACC_DEEP_COPY | |
597 | } | |
598 | ||
599 | AsnLen | |
600 | CertificationRequestSigned::BEncContent (BUF_TYPE b) | |
601 | { | |
602 | AsnLen totalLen = 0; | |
603 | AsnLen l; | |
604 | ||
605 | l = signature.BEncContent (b); | |
606 | l += BEncDefLen (b, l); | |
607 | ||
608 | l += BEncTag1 (b, UNIV, PRIM, BITSTRING_TAG_CODE); | |
609 | totalLen += l; | |
610 | ||
611 | BEncEocIfNec (b); | |
612 | l = signatureAlgorithm->BEncContent (b); | |
613 | l += BEncConsLen (b, l); | |
614 | ||
615 | l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); | |
616 | totalLen += l; | |
617 | ||
618 | ENC_LOAD_ANYBUF(&certificationRequestInfo, b, l); | |
619 | totalLen += l; | |
620 | ||
621 | return totalLen; | |
622 | } // CertificationRequestSigned::BEncContent | |
623 | ||
624 | ||
625 | void CertificationRequestSigned::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env) | |
626 | { | |
627 | AsnTag tag1; | |
628 | AsnLen seqBytesDecoded = 0; | |
629 | AsnLen elmtLen1; | |
630 | // ANY type | |
631 | DEC_LOAD_ANYBUF(&certificationRequestInfo, b, seqBytesDecoded, env); | |
632 | tag1 = BDecTag (b, seqBytesDecoded, env); | |
633 | ||
634 | ||
635 | if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))) | |
636 | { | |
637 | elmtLen1 = BDecLen (b, seqBytesDecoded, env); | |
638 | signatureAlgorithm = new SignatureAlgorithmIdentifier; | |
639 | signatureAlgorithm->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); | |
640 | tag1 = BDecTag (b, seqBytesDecoded, env); | |
641 | } | |
642 | else | |
643 | { | |
644 | Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; | |
645 | SnaccExcep::throwMe(-111); | |
646 | } | |
647 | ||
648 | if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, BITSTRING_TAG_CODE)) | |
649 | || (tag1 == MAKE_TAG_ID (UNIV, CONS, BITSTRING_TAG_CODE))) | |
650 | { | |
651 | elmtLen1 = BDecLen (b, seqBytesDecoded, env); | |
652 | signature.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env); | |
653 | } | |
654 | else | |
655 | { | |
656 | Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl; | |
657 | SnaccExcep::throwMe(-112); | |
658 | } | |
659 | ||
660 | bytesDecoded += seqBytesDecoded; | |
661 | if (elmtLen0 == INDEFINITE_LEN) | |
662 | { | |
663 | BDecEoc (b, bytesDecoded, env); | |
664 | return; | |
665 | } | |
666 | else if (seqBytesDecoded != elmtLen0) | |
667 | { | |
668 | Asn1Error << "ERROR - Length discrepancy on sequence." << endl; | |
669 | SnaccExcep::throwMe(-113); | |
670 | } | |
671 | else | |
672 | return; | |
673 | } // CertificationRequestSigned::BDecContent | |
674 | ||
675 | AsnLen CertificationRequestSigned::BEnc (BUF_TYPE b) | |
676 | { | |
677 | AsnLen l; | |
678 | l = BEncContent (b); | |
679 | l += BEncConsLen (b, l); | |
680 | l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE); | |
681 | return l; | |
682 | } | |
683 | ||
684 | void CertificationRequestSigned::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env) | |
685 | { | |
686 | AsnTag tag; | |
687 | AsnLen elmtLen1; | |
688 | ||
689 | if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)) | |
690 | { | |
691 | Asn1Error << "CertificationRequestSigned::BDec: ERROR - wrong tag" << endl; | |
692 | SnaccExcep::throwMe(-114); | |
693 | } | |
694 | elmtLen1 = BDecLen (b, bytesDecoded, env); | |
695 | BDecContent (b, tag, elmtLen1, bytesDecoded, env); | |
696 | } | |
697 | ||
698 | void CertificationRequestSigned::Print (ostream &os) const | |
699 | { | |
700 | #ifndef NDEBUG | |
701 | os << "{ -- SEQUENCE --" << endl; | |
702 | indentG += stdIndentG; | |
703 | ||
704 | { | |
705 | Indent (os, indentG); | |
706 | os << "certificationRequestInfo "; | |
707 | os << certificationRequestInfo; | |
708 | os << "," << endl; | |
709 | } | |
710 | ||
711 | if (NOT_NULL (signatureAlgorithm)) | |
712 | { | |
713 | Indent (os, indentG); | |
714 | os << "signatureAlgorithm "; | |
715 | os << *signatureAlgorithm; | |
716 | } | |
717 | else | |
718 | { | |
719 | Indent (os, indentG); | |
720 | os << "signatureAlgorithm "; | |
721 | os << "-- void --"; | |
722 | os << "," << endl; | |
723 | } | |
724 | ||
725 | { | |
726 | Indent (os, indentG); | |
727 | os << "signature "; | |
728 | os << signature; | |
729 | } | |
730 | ||
731 | os << endl; | |
732 | indentG -= stdIndentG; | |
733 | Indent (os, indentG); | |
734 | os << "}"; | |
735 | #endif /* NDEBUG */ | |
736 | } // CertificationRequestSigned::Print | |
737 | ||
738 |