Security-54.1.9.tar.gz
[apple/security.git] / SecurityASN1 / c++ / appleoids.cpp
1 // NOTE: this is a machine generated file--editing not recommended
2 //
3 // appleoids.cpp - class member functions for ASN.1 module APPLE-OIDS
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 DSABsafeParams::DSABsafeParams()
37 {
38 }
39
40 DSABsafeParams::DSABsafeParams (const DSABsafeParams &)
41 {
42 Asn1Error << "use of incompletely defined DSABsafeParams::DSABsafeParams (const DSABsafeParams &)" << endl;
43 abort();
44 }
45
46 DSABsafeParams::~DSABsafeParams()
47 {
48 }
49
50 AsnType *DSABsafeParams::Clone() const
51 {
52 return new DSABsafeParams;
53 }
54
55 AsnType *DSABsafeParams::Copy() const
56 {
57 return new DSABsafeParams (*this);
58 }
59
60 #if SNACC_DEEP_COPY
61 DSABsafeParams &DSABsafeParams::operator = (const DSABsafeParams &that)
62 #else // SNACC_DEEP_COPY
63 DSABsafeParams &DSABsafeParams::operator = (const DSABsafeParams &)
64 #endif // SNACC_DEEP_COPY
65 {
66 #if SNACC_DEEP_COPY
67 if (this != &that)
68 {
69 keySizeInBits = that.keySizeInBits;
70 p = that.p;
71 q = that.q;
72 g = that.g;
73 }
74
75 return *this;
76 #else // SNACC_DEEP_COPY
77 Asn1Error << "use of incompletely defined DSABsafeParams &DSABsafeParams::operator = (const DSABsafeParams &)" << endl;
78 abort();
79 // if your compiler complains here, check the -novolat option
80 #endif // SNACC_DEEP_COPY
81 }
82
83 AsnLen
84 DSABsafeParams::BEncContent (BUF_TYPE b)
85 {
86 AsnLen totalLen = 0;
87 AsnLen l;
88
89 l = g.BEncContent (b);
90 l += BEncDefLen (b, l);
91
92 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
93 totalLen += l;
94
95 l = q.BEncContent (b);
96 l += BEncDefLen (b, l);
97
98 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
99 totalLen += l;
100
101 l = p.BEncContent (b);
102 l += BEncDefLen (b, l);
103
104 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
105 totalLen += l;
106
107 l = keySizeInBits.BEncContent (b);
108 BEncDefLenTo127 (b, l);
109 l++;
110
111 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
112 totalLen += l;
113
114 return totalLen;
115 } // DSABsafeParams::BEncContent
116
117
118 void DSABsafeParams::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
119 {
120 AsnTag tag1;
121 AsnLen seqBytesDecoded = 0;
122 AsnLen elmtLen1;
123 tag1 = BDecTag (b, seqBytesDecoded, env);
124
125 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))
126 {
127 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
128 keySizeInBits.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
129 tag1 = BDecTag (b, seqBytesDecoded, env);
130 }
131 else
132 {
133 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
134 SnaccExcep::throwMe(-100);
135 }
136
137 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
138 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
139 {
140 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
141 p.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
142 tag1 = BDecTag (b, seqBytesDecoded, env);
143 }
144 else
145 {
146 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
147 SnaccExcep::throwMe(-101);
148 }
149
150 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
151 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
152 {
153 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
154 q.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
155 tag1 = BDecTag (b, seqBytesDecoded, env);
156 }
157 else
158 {
159 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
160 SnaccExcep::throwMe(-102);
161 }
162
163 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
164 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
165 {
166 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
167 g.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
168 }
169 else
170 {
171 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
172 SnaccExcep::throwMe(-103);
173 }
174
175 bytesDecoded += seqBytesDecoded;
176 if (elmtLen0 == INDEFINITE_LEN)
177 {
178 BDecEoc (b, bytesDecoded, env);
179 return;
180 }
181 else if (seqBytesDecoded != elmtLen0)
182 {
183 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
184 SnaccExcep::throwMe(-104);
185 }
186 else
187 return;
188 } // DSABsafeParams::BDecContent
189
190 AsnLen DSABsafeParams::BEnc (BUF_TYPE b)
191 {
192 AsnLen l;
193 l = BEncContent (b);
194 l += BEncConsLen (b, l);
195 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
196 return l;
197 }
198
199 void DSABsafeParams::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
200 {
201 AsnTag tag;
202 AsnLen elmtLen1;
203
204 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
205 {
206 Asn1Error << "DSABsafeParams::BDec: ERROR - wrong tag" << endl;
207 SnaccExcep::throwMe(-105);
208 }
209 elmtLen1 = BDecLen (b, bytesDecoded, env);
210 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
211 }
212
213 void DSABsafeParams::Print (ostream &os) const
214 {
215 #ifndef NDEBUG
216 os << "{ -- SEQUENCE --" << endl;
217 indentG += stdIndentG;
218
219 {
220 Indent (os, indentG);
221 os << "keySizeInBits ";
222 os << keySizeInBits;
223 os << "," << endl;
224 }
225
226 {
227 Indent (os, indentG);
228 os << "p ";
229 os << p;
230 os << "," << endl;
231 }
232
233 {
234 Indent (os, indentG);
235 os << "q ";
236 os << q;
237 os << "," << endl;
238 }
239
240 {
241 Indent (os, indentG);
242 os << "g ";
243 os << g;
244 }
245
246 os << endl;
247 indentG -= stdIndentG;
248 Indent (os, indentG);
249 os << "}";
250 #endif /* NDEBUG */
251 } // DSABsafeParams::Print
252
253
254 DHParameter::DHParameter()
255 {
256 privateValueLength = NULL;
257 }
258
259 DHParameter::DHParameter (const DHParameter &)
260 {
261 Asn1Error << "use of incompletely defined DHParameter::DHParameter (const DHParameter &)" << endl;
262 abort();
263 }
264
265 DHParameter::~DHParameter()
266 {
267 delete privateValueLength;
268 }
269
270 AsnType *DHParameter::Clone() const
271 {
272 return new DHParameter;
273 }
274
275 AsnType *DHParameter::Copy() const
276 {
277 return new DHParameter (*this);
278 }
279
280 #if SNACC_DEEP_COPY
281 DHParameter &DHParameter::operator = (const DHParameter &that)
282 #else // SNACC_DEEP_COPY
283 DHParameter &DHParameter::operator = (const DHParameter &)
284 #endif // SNACC_DEEP_COPY
285 {
286 #if SNACC_DEEP_COPY
287 if (this != &that)
288 {
289 prime = that.prime;
290 base = that.base;
291 if (that.privateValueLength)
292 {
293 if (!privateValueLength)
294 privateValueLength = new BigIntegerStr;
295 *privateValueLength = *that.privateValueLength;
296 }
297 else
298 {
299 delete privateValueLength;
300 privateValueLength = NULL;
301 }
302 }
303
304 return *this;
305 #else // SNACC_DEEP_COPY
306 Asn1Error << "use of incompletely defined DHParameter &DHParameter::operator = (const DHParameter &)" << endl;
307 abort();
308 // if your compiler complains here, check the -novolat option
309 #endif // SNACC_DEEP_COPY
310 }
311
312 AsnLen
313 DHParameter::BEncContent (BUF_TYPE b)
314 {
315 AsnLen totalLen = 0;
316 AsnLen l;
317
318 if (NOT_NULL (privateValueLength))
319 {
320 l = privateValueLength->BEncContent (b);
321 l += BEncDefLen (b, l);
322
323 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
324 totalLen += l;
325 }
326
327 l = base.BEncContent (b);
328 l += BEncDefLen (b, l);
329
330 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
331 totalLen += l;
332
333 l = prime.BEncContent (b);
334 l += BEncDefLen (b, l);
335
336 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
337 totalLen += l;
338
339 return totalLen;
340 } // DHParameter::BEncContent
341
342
343 void DHParameter::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
344 {
345 AsnTag tag1;
346 AsnLen seqBytesDecoded = 0;
347 AsnLen elmtLen1;
348 tag1 = BDecTag (b, seqBytesDecoded, env);
349
350 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
351 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
352 {
353 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
354 prime.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
355 tag1 = BDecTag (b, seqBytesDecoded, env);
356 }
357 else
358 {
359 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
360 SnaccExcep::throwMe(-106);
361 }
362
363 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
364 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
365 {
366 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
367 base.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
368 if (seqBytesDecoded == elmtLen0)
369 {
370 bytesDecoded += seqBytesDecoded;
371 return;
372 }
373 else
374 {
375 tag1 = BDecTag (b, seqBytesDecoded, env);
376
377 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
378 {
379 BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env)
380 bytesDecoded += seqBytesDecoded;
381 return;
382 }
383 }
384 }
385 else
386 {
387 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
388 SnaccExcep::throwMe(-107);
389 }
390
391 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
392 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
393 {
394 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
395 privateValueLength = new BigIntegerStr;
396 privateValueLength->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
397 }
398
399 bytesDecoded += seqBytesDecoded;
400 if (elmtLen0 == INDEFINITE_LEN)
401 {
402 BDecEoc (b, bytesDecoded, env);
403 return;
404 }
405 else if (seqBytesDecoded != elmtLen0)
406 {
407 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
408 SnaccExcep::throwMe(-108);
409 }
410 else
411 return;
412 } // DHParameter::BDecContent
413
414 AsnLen DHParameter::BEnc (BUF_TYPE b)
415 {
416 AsnLen l;
417 l = BEncContent (b);
418 l += BEncConsLen (b, l);
419 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
420 return l;
421 }
422
423 void DHParameter::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
424 {
425 AsnTag tag;
426 AsnLen elmtLen1;
427
428 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
429 {
430 Asn1Error << "DHParameter::BDec: ERROR - wrong tag" << endl;
431 SnaccExcep::throwMe(-109);
432 }
433 elmtLen1 = BDecLen (b, bytesDecoded, env);
434 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
435 }
436
437 void DHParameter::Print (ostream &os) const
438 {
439 #ifndef NDEBUG
440 os << "{ -- SEQUENCE --" << endl;
441 indentG += stdIndentG;
442
443 {
444 Indent (os, indentG);
445 os << "prime ";
446 os << prime;
447 os << "," << endl;
448 }
449
450 {
451 Indent (os, indentG);
452 os << "base ";
453 os << base;
454 os << "," << endl;
455 }
456
457 if (NOT_NULL (privateValueLength))
458 {
459 os << ","<< endl;
460 Indent (os, indentG);
461 os << "privateValueLength ";
462 os << *privateValueLength;
463 }
464 else
465 {
466 Indent (os, indentG);
467 os << "privateValueLength ";
468 os << "-- void --";
469 os << endl;
470 }
471
472 os << endl;
473 indentG -= stdIndentG;
474 Indent (os, indentG);
475 os << "}";
476 #endif /* NDEBUG */
477 } // DHParameter::Print
478
479
480 FEECurveParameters::FEECurveParameters()
481 {
482 basePrime = NULL;
483 }
484
485 FEECurveParameters::FEECurveParameters (const FEECurveParameters &)
486 {
487 Asn1Error << "use of incompletely defined FEECurveParameters::FEECurveParameters (const FEECurveParameters &)" << endl;
488 abort();
489 }
490
491 FEECurveParameters::~FEECurveParameters()
492 {
493 delete basePrime;
494 }
495
496 AsnType *FEECurveParameters::Clone() const
497 {
498 return new FEECurveParameters;
499 }
500
501 AsnType *FEECurveParameters::Copy() const
502 {
503 return new FEECurveParameters (*this);
504 }
505
506 #if SNACC_DEEP_COPY
507 FEECurveParameters &FEECurveParameters::operator = (const FEECurveParameters &that)
508 #else // SNACC_DEEP_COPY
509 FEECurveParameters &FEECurveParameters::operator = (const FEECurveParameters &)
510 #endif // SNACC_DEEP_COPY
511 {
512 #if SNACC_DEEP_COPY
513 if (this != &that)
514 {
515 primeType = that.primeType;
516 curveType = that.curveType;
517 q = that.q;
518 k = that.k;
519 m = that.m;
520 a = that.a;
521 bb = that.bb;
522 c = that.c;
523 x1Plus = that.x1Plus;
524 x1Minus = that.x1Minus;
525 cOrderPlus = that.cOrderPlus;
526 cOrderMinus = that.cOrderMinus;
527 x1OrderPlus = that.x1OrderPlus;
528 x1OrderMinus = that.x1OrderMinus;
529 if (that.basePrime)
530 {
531 if (!basePrime)
532 basePrime = new BigIntegerStr;
533 *basePrime = *that.basePrime;
534 }
535 else
536 {
537 delete basePrime;
538 basePrime = NULL;
539 }
540 }
541
542 return *this;
543 #else // SNACC_DEEP_COPY
544 Asn1Error << "use of incompletely defined FEECurveParameters &FEECurveParameters::operator = (const FEECurveParameters &)" << endl;
545 abort();
546 // if your compiler complains here, check the -novolat option
547 #endif // SNACC_DEEP_COPY
548 }
549
550 AsnLen
551 FEECurveParameters::BEncContent (BUF_TYPE b)
552 {
553 AsnLen totalLen = 0;
554 AsnLen l;
555
556 if (NOT_NULL (basePrime))
557 {
558 l = basePrime->BEncContent (b);
559 l += BEncDefLen (b, l);
560
561 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
562 totalLen += l;
563 }
564
565 l = x1OrderMinus.BEncContent (b);
566 l += BEncDefLen (b, l);
567
568 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
569 totalLen += l;
570
571 l = x1OrderPlus.BEncContent (b);
572 l += BEncDefLen (b, l);
573
574 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
575 totalLen += l;
576
577 l = cOrderMinus.BEncContent (b);
578 l += BEncDefLen (b, l);
579
580 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
581 totalLen += l;
582
583 l = cOrderPlus.BEncContent (b);
584 l += BEncDefLen (b, l);
585
586 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
587 totalLen += l;
588
589 l = x1Minus.BEncContent (b);
590 l += BEncDefLen (b, l);
591
592 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
593 totalLen += l;
594
595 l = x1Plus.BEncContent (b);
596 l += BEncDefLen (b, l);
597
598 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
599 totalLen += l;
600
601 l = c.BEncContent (b);
602 l += BEncDefLen (b, l);
603
604 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
605 totalLen += l;
606
607 l = bb.BEncContent (b);
608 l += BEncDefLen (b, l);
609
610 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
611 totalLen += l;
612
613 l = a.BEncContent (b);
614 l += BEncDefLen (b, l);
615
616 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
617 totalLen += l;
618
619 l = m.BEncContent (b);
620 BEncDefLenTo127 (b, l);
621 l++;
622
623 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
624 totalLen += l;
625
626 l = k.BEncContent (b);
627 BEncDefLenTo127 (b, l);
628 l++;
629
630 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
631 totalLen += l;
632
633 l = q.BEncContent (b);
634 BEncDefLenTo127 (b, l);
635 l++;
636
637 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
638 totalLen += l;
639
640 l = curveType.BEncContent (b);
641 BEncDefLenTo127 (b, l);
642 l++;
643
644 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
645 totalLen += l;
646
647 l = primeType.BEncContent (b);
648 BEncDefLenTo127 (b, l);
649 l++;
650
651 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
652 totalLen += l;
653
654 return totalLen;
655 } // FEECurveParameters::BEncContent
656
657
658 void FEECurveParameters::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
659 {
660 AsnTag tag1;
661 AsnLen seqBytesDecoded = 0;
662 AsnLen elmtLen1;
663 tag1 = BDecTag (b, seqBytesDecoded, env);
664
665 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))
666 {
667 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
668 primeType.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
669 tag1 = BDecTag (b, seqBytesDecoded, env);
670 }
671 else
672 {
673 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
674 SnaccExcep::throwMe(-110);
675 }
676
677 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))
678 {
679 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
680 curveType.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
681 tag1 = BDecTag (b, seqBytesDecoded, env);
682 }
683 else
684 {
685 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
686 SnaccExcep::throwMe(-111);
687 }
688
689 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))
690 {
691 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
692 q.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
693 tag1 = BDecTag (b, seqBytesDecoded, env);
694 }
695 else
696 {
697 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
698 SnaccExcep::throwMe(-112);
699 }
700
701 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))
702 {
703 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
704 k.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
705 tag1 = BDecTag (b, seqBytesDecoded, env);
706 }
707 else
708 {
709 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
710 SnaccExcep::throwMe(-113);
711 }
712
713 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))
714 {
715 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
716 m.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
717 tag1 = BDecTag (b, seqBytesDecoded, env);
718 }
719 else
720 {
721 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
722 SnaccExcep::throwMe(-114);
723 }
724
725 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
726 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
727 {
728 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
729 a.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
730 tag1 = BDecTag (b, seqBytesDecoded, env);
731 }
732 else
733 {
734 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
735 SnaccExcep::throwMe(-115);
736 }
737
738 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
739 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
740 {
741 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
742 bb.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
743 tag1 = BDecTag (b, seqBytesDecoded, env);
744 }
745 else
746 {
747 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
748 SnaccExcep::throwMe(-116);
749 }
750
751 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
752 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
753 {
754 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
755 c.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
756 tag1 = BDecTag (b, seqBytesDecoded, env);
757 }
758 else
759 {
760 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
761 SnaccExcep::throwMe(-117);
762 }
763
764 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
765 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
766 {
767 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
768 x1Plus.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
769 tag1 = BDecTag (b, seqBytesDecoded, env);
770 }
771 else
772 {
773 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
774 SnaccExcep::throwMe(-118);
775 }
776
777 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
778 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
779 {
780 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
781 x1Minus.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
782 tag1 = BDecTag (b, seqBytesDecoded, env);
783 }
784 else
785 {
786 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
787 SnaccExcep::throwMe(-119);
788 }
789
790 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
791 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
792 {
793 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
794 cOrderPlus.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
795 tag1 = BDecTag (b, seqBytesDecoded, env);
796 }
797 else
798 {
799 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
800 SnaccExcep::throwMe(-120);
801 }
802
803 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
804 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
805 {
806 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
807 cOrderMinus.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
808 tag1 = BDecTag (b, seqBytesDecoded, env);
809 }
810 else
811 {
812 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
813 SnaccExcep::throwMe(-121);
814 }
815
816 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
817 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
818 {
819 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
820 x1OrderPlus.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
821 tag1 = BDecTag (b, seqBytesDecoded, env);
822 }
823 else
824 {
825 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
826 SnaccExcep::throwMe(-122);
827 }
828
829 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
830 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
831 {
832 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
833 x1OrderMinus.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
834 if (seqBytesDecoded == elmtLen0)
835 {
836 bytesDecoded += seqBytesDecoded;
837 return;
838 }
839 else
840 {
841 tag1 = BDecTag (b, seqBytesDecoded, env);
842
843 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
844 {
845 BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env)
846 bytesDecoded += seqBytesDecoded;
847 return;
848 }
849 }
850 }
851 else
852 {
853 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
854 SnaccExcep::throwMe(-123);
855 }
856
857 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
858 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
859 {
860 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
861 basePrime = new BigIntegerStr;
862 basePrime->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
863 }
864
865 bytesDecoded += seqBytesDecoded;
866 if (elmtLen0 == INDEFINITE_LEN)
867 {
868 BDecEoc (b, bytesDecoded, env);
869 return;
870 }
871 else if (seqBytesDecoded != elmtLen0)
872 {
873 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
874 SnaccExcep::throwMe(-124);
875 }
876 else
877 return;
878 } // FEECurveParameters::BDecContent
879
880 AsnLen FEECurveParameters::BEnc (BUF_TYPE b)
881 {
882 AsnLen l;
883 l = BEncContent (b);
884 l += BEncConsLen (b, l);
885 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
886 return l;
887 }
888
889 void FEECurveParameters::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
890 {
891 AsnTag tag;
892 AsnLen elmtLen1;
893
894 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
895 {
896 Asn1Error << "FEECurveParameters::BDec: ERROR - wrong tag" << endl;
897 SnaccExcep::throwMe(-125);
898 }
899 elmtLen1 = BDecLen (b, bytesDecoded, env);
900 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
901 }
902
903 void FEECurveParameters::Print (ostream &os) const
904 {
905 #ifndef NDEBUG
906 os << "{ -- SEQUENCE --" << endl;
907 indentG += stdIndentG;
908
909 {
910 Indent (os, indentG);
911 os << "primeType ";
912 os << primeType;
913 os << "," << endl;
914 }
915
916 {
917 Indent (os, indentG);
918 os << "curveType ";
919 os << curveType;
920 os << "," << endl;
921 }
922
923 {
924 Indent (os, indentG);
925 os << "q ";
926 os << q;
927 os << "," << endl;
928 }
929
930 {
931 Indent (os, indentG);
932 os << "k ";
933 os << k;
934 os << "," << endl;
935 }
936
937 {
938 Indent (os, indentG);
939 os << "m ";
940 os << m;
941 os << "," << endl;
942 }
943
944 {
945 Indent (os, indentG);
946 os << "a ";
947 os << a;
948 os << "," << endl;
949 }
950
951 {
952 Indent (os, indentG);
953 os << "bb ";
954 os << bb;
955 os << "," << endl;
956 }
957
958 {
959 Indent (os, indentG);
960 os << "c ";
961 os << c;
962 os << "," << endl;
963 }
964
965 {
966 Indent (os, indentG);
967 os << "x1Plus ";
968 os << x1Plus;
969 os << "," << endl;
970 }
971
972 {
973 Indent (os, indentG);
974 os << "x1Minus ";
975 os << x1Minus;
976 os << "," << endl;
977 }
978
979 {
980 Indent (os, indentG);
981 os << "cOrderPlus ";
982 os << cOrderPlus;
983 os << "," << endl;
984 }
985
986 {
987 Indent (os, indentG);
988 os << "cOrderMinus ";
989 os << cOrderMinus;
990 os << "," << endl;
991 }
992
993 {
994 Indent (os, indentG);
995 os << "x1OrderPlus ";
996 os << x1OrderPlus;
997 os << "," << endl;
998 }
999
1000 {
1001 Indent (os, indentG);
1002 os << "x1OrderMinus ";
1003 os << x1OrderMinus;
1004 os << "," << endl;
1005 }
1006
1007 if (NOT_NULL (basePrime))
1008 {
1009 os << ","<< endl;
1010 Indent (os, indentG);
1011 os << "basePrime ";
1012 os << *basePrime;
1013 }
1014 else
1015 {
1016 Indent (os, indentG);
1017 os << "basePrime ";
1018 os << "-- void --";
1019 os << endl;
1020 }
1021
1022 os << endl;
1023 indentG -= stdIndentG;
1024 Indent (os, indentG);
1025 os << "}";
1026 #endif /* NDEBUG */
1027 } // FEECurveParameters::Print
1028
1029
1030 DSAAlgorithmId::DSAAlgorithmId()
1031 {
1032 #if TCL
1033 params = new DSABsafeParams;
1034 #else
1035 params = NULL; // incomplete initialization of mandatory element!
1036 #endif // TCL
1037 }
1038
1039 DSAAlgorithmId::DSAAlgorithmId (const DSAAlgorithmId &)
1040 {
1041 Asn1Error << "use of incompletely defined DSAAlgorithmId::DSAAlgorithmId (const DSAAlgorithmId &)" << endl;
1042 abort();
1043 }
1044
1045 DSAAlgorithmId::~DSAAlgorithmId()
1046 {
1047 delete params;
1048 }
1049
1050 AsnType *DSAAlgorithmId::Clone() const
1051 {
1052 return new DSAAlgorithmId;
1053 }
1054
1055 AsnType *DSAAlgorithmId::Copy() const
1056 {
1057 return new DSAAlgorithmId (*this);
1058 }
1059
1060 #if SNACC_DEEP_COPY
1061 DSAAlgorithmId &DSAAlgorithmId::operator = (const DSAAlgorithmId &that)
1062 #else // SNACC_DEEP_COPY
1063 DSAAlgorithmId &DSAAlgorithmId::operator = (const DSAAlgorithmId &)
1064 #endif // SNACC_DEEP_COPY
1065 {
1066 #if SNACC_DEEP_COPY
1067 if (this != &that)
1068 {
1069 algorithm = that.algorithm;
1070 if (that.params)
1071 {
1072 if (!params)
1073 params = new DSABsafeParams;
1074 *params = *that.params;
1075 }
1076 else
1077 {
1078 delete params;
1079 params = NULL;
1080 }
1081 }
1082
1083 return *this;
1084 #else // SNACC_DEEP_COPY
1085 Asn1Error << "use of incompletely defined DSAAlgorithmId &DSAAlgorithmId::operator = (const DSAAlgorithmId &)" << endl;
1086 abort();
1087 // if your compiler complains here, check the -novolat option
1088 #endif // SNACC_DEEP_COPY
1089 }
1090
1091 AsnLen
1092 DSAAlgorithmId::BEncContent (BUF_TYPE b)
1093 {
1094 AsnLen totalLen = 0;
1095 AsnLen l;
1096
1097 BEncEocIfNec (b);
1098 l = params->BEncContent (b);
1099 l += BEncConsLen (b, l);
1100
1101 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
1102 totalLen += l;
1103
1104 l = algorithm.BEncContent (b);
1105 l += BEncDefLen (b, l);
1106
1107 l += BEncTag1 (b, UNIV, PRIM, OID_TAG_CODE);
1108 totalLen += l;
1109
1110 return totalLen;
1111 } // DSAAlgorithmId::BEncContent
1112
1113
1114 void DSAAlgorithmId::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
1115 {
1116 AsnTag tag1;
1117 AsnLen seqBytesDecoded = 0;
1118 AsnLen elmtLen1;
1119 tag1 = BDecTag (b, seqBytesDecoded, env);
1120
1121 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, OID_TAG_CODE)))
1122 {
1123 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1124 algorithm.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1125 tag1 = BDecTag (b, seqBytesDecoded, env);
1126 }
1127 else
1128 {
1129 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1130 SnaccExcep::throwMe(-126);
1131 }
1132
1133 if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
1134 {
1135 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1136 params = new DSABsafeParams;
1137 params->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1138 }
1139 else
1140 {
1141 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1142 SnaccExcep::throwMe(-127);
1143 }
1144
1145 bytesDecoded += seqBytesDecoded;
1146 if (elmtLen0 == INDEFINITE_LEN)
1147 {
1148 BDecEoc (b, bytesDecoded, env);
1149 return;
1150 }
1151 else if (seqBytesDecoded != elmtLen0)
1152 {
1153 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
1154 SnaccExcep::throwMe(-128);
1155 }
1156 else
1157 return;
1158 } // DSAAlgorithmId::BDecContent
1159
1160 AsnLen DSAAlgorithmId::BEnc (BUF_TYPE b)
1161 {
1162 AsnLen l;
1163 l = BEncContent (b);
1164 l += BEncConsLen (b, l);
1165 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
1166 return l;
1167 }
1168
1169 void DSAAlgorithmId::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
1170 {
1171 AsnTag tag;
1172 AsnLen elmtLen1;
1173
1174 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
1175 {
1176 Asn1Error << "DSAAlgorithmId::BDec: ERROR - wrong tag" << endl;
1177 SnaccExcep::throwMe(-129);
1178 }
1179 elmtLen1 = BDecLen (b, bytesDecoded, env);
1180 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
1181 }
1182
1183 void DSAAlgorithmId::Print (ostream &os) const
1184 {
1185 #ifndef NDEBUG
1186 os << "{ -- SEQUENCE --" << endl;
1187 indentG += stdIndentG;
1188
1189 {
1190 Indent (os, indentG);
1191 os << "algorithm ";
1192 os << algorithm;
1193 os << "," << endl;
1194 }
1195
1196 if (NOT_NULL (params))
1197 {
1198 Indent (os, indentG);
1199 os << "params ";
1200 os << *params;
1201 }
1202 else
1203 {
1204 Indent (os, indentG);
1205 os << "params ";
1206 os << "-- void --";
1207 os << endl;
1208 }
1209
1210 os << endl;
1211 indentG -= stdIndentG;
1212 Indent (os, indentG);
1213 os << "}";
1214 #endif /* NDEBUG */
1215 } // DSAAlgorithmId::Print
1216
1217
1218 FEEElGamalSignature::FEEElGamalSignature()
1219 {
1220 }
1221
1222 FEEElGamalSignature::FEEElGamalSignature (const FEEElGamalSignature &)
1223 {
1224 Asn1Error << "use of incompletely defined FEEElGamalSignature::FEEElGamalSignature (const FEEElGamalSignature &)" << endl;
1225 abort();
1226 }
1227
1228 FEEElGamalSignature::~FEEElGamalSignature()
1229 {
1230 }
1231
1232 AsnType *FEEElGamalSignature::Clone() const
1233 {
1234 return new FEEElGamalSignature;
1235 }
1236
1237 AsnType *FEEElGamalSignature::Copy() const
1238 {
1239 return new FEEElGamalSignature (*this);
1240 }
1241
1242 #if SNACC_DEEP_COPY
1243 FEEElGamalSignature &FEEElGamalSignature::operator = (const FEEElGamalSignature &that)
1244 #else // SNACC_DEEP_COPY
1245 FEEElGamalSignature &FEEElGamalSignature::operator = (const FEEElGamalSignature &)
1246 #endif // SNACC_DEEP_COPY
1247 {
1248 #if SNACC_DEEP_COPY
1249 if (this != &that)
1250 {
1251 u = that.u;
1252 pmX = that.pmX;
1253 }
1254
1255 return *this;
1256 #else // SNACC_DEEP_COPY
1257 Asn1Error << "use of incompletely defined FEEElGamalSignature &FEEElGamalSignature::operator = (const FEEElGamalSignature &)" << endl;
1258 abort();
1259 // if your compiler complains here, check the -novolat option
1260 #endif // SNACC_DEEP_COPY
1261 }
1262
1263 AsnLen
1264 FEEElGamalSignature::BEncContent (BUF_TYPE b)
1265 {
1266 AsnLen totalLen = 0;
1267 AsnLen l;
1268
1269 l = pmX.BEncContent (b);
1270 l += BEncDefLen (b, l);
1271
1272 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
1273 totalLen += l;
1274
1275 l = u.BEncContent (b);
1276 l += BEncDefLen (b, l);
1277
1278 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
1279 totalLen += l;
1280
1281 return totalLen;
1282 } // FEEElGamalSignature::BEncContent
1283
1284
1285 void FEEElGamalSignature::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
1286 {
1287 AsnTag tag1;
1288 AsnLen seqBytesDecoded = 0;
1289 AsnLen elmtLen1;
1290 tag1 = BDecTag (b, seqBytesDecoded, env);
1291
1292 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
1293 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
1294 {
1295 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1296 u.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1297 tag1 = BDecTag (b, seqBytesDecoded, env);
1298 }
1299 else
1300 {
1301 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1302 SnaccExcep::throwMe(-130);
1303 }
1304
1305 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
1306 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
1307 {
1308 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1309 pmX.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1310 }
1311 else
1312 {
1313 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1314 SnaccExcep::throwMe(-131);
1315 }
1316
1317 bytesDecoded += seqBytesDecoded;
1318 if (elmtLen0 == INDEFINITE_LEN)
1319 {
1320 BDecEoc (b, bytesDecoded, env);
1321 return;
1322 }
1323 else if (seqBytesDecoded != elmtLen0)
1324 {
1325 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
1326 SnaccExcep::throwMe(-132);
1327 }
1328 else
1329 return;
1330 } // FEEElGamalSignature::BDecContent
1331
1332 AsnLen FEEElGamalSignature::BEnc (BUF_TYPE b)
1333 {
1334 AsnLen l;
1335 l = BEncContent (b);
1336 l += BEncConsLen (b, l);
1337 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
1338 return l;
1339 }
1340
1341 void FEEElGamalSignature::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
1342 {
1343 AsnTag tag;
1344 AsnLen elmtLen1;
1345
1346 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
1347 {
1348 Asn1Error << "FEEElGamalSignature::BDec: ERROR - wrong tag" << endl;
1349 SnaccExcep::throwMe(-133);
1350 }
1351 elmtLen1 = BDecLen (b, bytesDecoded, env);
1352 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
1353 }
1354
1355 void FEEElGamalSignature::Print (ostream &os) const
1356 {
1357 #ifndef NDEBUG
1358 os << "{ -- SEQUENCE --" << endl;
1359 indentG += stdIndentG;
1360
1361 {
1362 Indent (os, indentG);
1363 os << "u ";
1364 os << u;
1365 os << "," << endl;
1366 }
1367
1368 {
1369 Indent (os, indentG);
1370 os << "pmX ";
1371 os << pmX;
1372 }
1373
1374 os << endl;
1375 indentG -= stdIndentG;
1376 Indent (os, indentG);
1377 os << "}";
1378 #endif /* NDEBUG */
1379 } // FEEElGamalSignature::Print
1380
1381
1382 FEEECDSASignature::FEEECDSASignature()
1383 {
1384 }
1385
1386 FEEECDSASignature::FEEECDSASignature (const FEEECDSASignature &)
1387 {
1388 Asn1Error << "use of incompletely defined FEEECDSASignature::FEEECDSASignature (const FEEECDSASignature &)" << endl;
1389 abort();
1390 }
1391
1392 FEEECDSASignature::~FEEECDSASignature()
1393 {
1394 }
1395
1396 AsnType *FEEECDSASignature::Clone() const
1397 {
1398 return new FEEECDSASignature;
1399 }
1400
1401 AsnType *FEEECDSASignature::Copy() const
1402 {
1403 return new FEEECDSASignature (*this);
1404 }
1405
1406 #if SNACC_DEEP_COPY
1407 FEEECDSASignature &FEEECDSASignature::operator = (const FEEECDSASignature &that)
1408 #else // SNACC_DEEP_COPY
1409 FEEECDSASignature &FEEECDSASignature::operator = (const FEEECDSASignature &)
1410 #endif // SNACC_DEEP_COPY
1411 {
1412 #if SNACC_DEEP_COPY
1413 if (this != &that)
1414 {
1415 c = that.c;
1416 d = that.d;
1417 }
1418
1419 return *this;
1420 #else // SNACC_DEEP_COPY
1421 Asn1Error << "use of incompletely defined FEEECDSASignature &FEEECDSASignature::operator = (const FEEECDSASignature &)" << endl;
1422 abort();
1423 // if your compiler complains here, check the -novolat option
1424 #endif // SNACC_DEEP_COPY
1425 }
1426
1427 AsnLen
1428 FEEECDSASignature::BEncContent (BUF_TYPE b)
1429 {
1430 AsnLen totalLen = 0;
1431 AsnLen l;
1432
1433 l = d.BEncContent (b);
1434 l += BEncDefLen (b, l);
1435
1436 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
1437 totalLen += l;
1438
1439 l = c.BEncContent (b);
1440 l += BEncDefLen (b, l);
1441
1442 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
1443 totalLen += l;
1444
1445 return totalLen;
1446 } // FEEECDSASignature::BEncContent
1447
1448
1449 void FEEECDSASignature::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
1450 {
1451 AsnTag tag1;
1452 AsnLen seqBytesDecoded = 0;
1453 AsnLen elmtLen1;
1454 tag1 = BDecTag (b, seqBytesDecoded, env);
1455
1456 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
1457 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
1458 {
1459 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1460 c.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1461 tag1 = BDecTag (b, seqBytesDecoded, env);
1462 }
1463 else
1464 {
1465 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1466 SnaccExcep::throwMe(-134);
1467 }
1468
1469 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
1470 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
1471 {
1472 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1473 d.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1474 }
1475 else
1476 {
1477 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1478 SnaccExcep::throwMe(-135);
1479 }
1480
1481 bytesDecoded += seqBytesDecoded;
1482 if (elmtLen0 == INDEFINITE_LEN)
1483 {
1484 BDecEoc (b, bytesDecoded, env);
1485 return;
1486 }
1487 else if (seqBytesDecoded != elmtLen0)
1488 {
1489 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
1490 SnaccExcep::throwMe(-136);
1491 }
1492 else
1493 return;
1494 } // FEEECDSASignature::BDecContent
1495
1496 AsnLen FEEECDSASignature::BEnc (BUF_TYPE b)
1497 {
1498 AsnLen l;
1499 l = BEncContent (b);
1500 l += BEncConsLen (b, l);
1501 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
1502 return l;
1503 }
1504
1505 void FEEECDSASignature::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
1506 {
1507 AsnTag tag;
1508 AsnLen elmtLen1;
1509
1510 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
1511 {
1512 Asn1Error << "FEEECDSASignature::BDec: ERROR - wrong tag" << endl;
1513 SnaccExcep::throwMe(-137);
1514 }
1515 elmtLen1 = BDecLen (b, bytesDecoded, env);
1516 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
1517 }
1518
1519 void FEEECDSASignature::Print (ostream &os) const
1520 {
1521 #ifndef NDEBUG
1522 os << "{ -- SEQUENCE --" << endl;
1523 indentG += stdIndentG;
1524
1525 {
1526 Indent (os, indentG);
1527 os << "c ";
1528 os << c;
1529 os << "," << endl;
1530 }
1531
1532 {
1533 Indent (os, indentG);
1534 os << "d ";
1535 os << d;
1536 }
1537
1538 os << endl;
1539 indentG -= stdIndentG;
1540 Indent (os, indentG);
1541 os << "}";
1542 #endif /* NDEBUG */
1543 } // FEEECDSASignature::Print
1544
1545
1546 FEEPublicKey::FEEPublicKey()
1547 {
1548 #if TCL
1549 curveParams = new FEECurveParameters;
1550 #else
1551 curveParams = NULL; // incomplete initialization of mandatory element!
1552 #endif // TCL
1553 plusY = NULL;
1554 }
1555
1556 FEEPublicKey::FEEPublicKey (const FEEPublicKey &)
1557 {
1558 Asn1Error << "use of incompletely defined FEEPublicKey::FEEPublicKey (const FEEPublicKey &)" << endl;
1559 abort();
1560 }
1561
1562 FEEPublicKey::~FEEPublicKey()
1563 {
1564 delete curveParams;
1565 delete plusY;
1566 }
1567
1568 AsnType *FEEPublicKey::Clone() const
1569 {
1570 return new FEEPublicKey;
1571 }
1572
1573 AsnType *FEEPublicKey::Copy() const
1574 {
1575 return new FEEPublicKey (*this);
1576 }
1577
1578 #if SNACC_DEEP_COPY
1579 FEEPublicKey &FEEPublicKey::operator = (const FEEPublicKey &that)
1580 #else // SNACC_DEEP_COPY
1581 FEEPublicKey &FEEPublicKey::operator = (const FEEPublicKey &)
1582 #endif // SNACC_DEEP_COPY
1583 {
1584 #if SNACC_DEEP_COPY
1585 if (this != &that)
1586 {
1587 version = that.version;
1588 if (that.curveParams)
1589 {
1590 if (!curveParams)
1591 curveParams = new FEECurveParameters;
1592 *curveParams = *that.curveParams;
1593 }
1594 else
1595 {
1596 delete curveParams;
1597 curveParams = NULL;
1598 }
1599 plusX = that.plusX;
1600 minusX = that.minusX;
1601 if (that.plusY)
1602 {
1603 if (!plusY)
1604 plusY = new BigIntegerStr;
1605 *plusY = *that.plusY;
1606 }
1607 else
1608 {
1609 delete plusY;
1610 plusY = NULL;
1611 }
1612 }
1613
1614 return *this;
1615 #else // SNACC_DEEP_COPY
1616 Asn1Error << "use of incompletely defined FEEPublicKey &FEEPublicKey::operator = (const FEEPublicKey &)" << endl;
1617 abort();
1618 // if your compiler complains here, check the -novolat option
1619 #endif // SNACC_DEEP_COPY
1620 }
1621
1622 AsnLen
1623 FEEPublicKey::BEncContent (BUF_TYPE b)
1624 {
1625 AsnLen totalLen = 0;
1626 AsnLen l;
1627
1628 if (NOT_NULL (plusY))
1629 {
1630 l = plusY->BEncContent (b);
1631 l += BEncDefLen (b, l);
1632
1633 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
1634 totalLen += l;
1635 }
1636
1637 l = minusX.BEncContent (b);
1638 l += BEncDefLen (b, l);
1639
1640 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
1641 totalLen += l;
1642
1643 l = plusX.BEncContent (b);
1644 l += BEncDefLen (b, l);
1645
1646 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
1647 totalLen += l;
1648
1649 BEncEocIfNec (b);
1650 l = curveParams->BEncContent (b);
1651 l += BEncConsLen (b, l);
1652
1653 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
1654 totalLen += l;
1655
1656 l = version.BEncContent (b);
1657 BEncDefLenTo127 (b, l);
1658 l++;
1659
1660 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
1661 totalLen += l;
1662
1663 return totalLen;
1664 } // FEEPublicKey::BEncContent
1665
1666
1667 void FEEPublicKey::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
1668 {
1669 AsnTag tag1;
1670 AsnLen seqBytesDecoded = 0;
1671 AsnLen elmtLen1;
1672 tag1 = BDecTag (b, seqBytesDecoded, env);
1673
1674 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))
1675 {
1676 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1677 version.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1678 tag1 = BDecTag (b, seqBytesDecoded, env);
1679 }
1680 else
1681 {
1682 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1683 SnaccExcep::throwMe(-138);
1684 }
1685
1686 if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
1687 {
1688 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1689 curveParams = new FEECurveParameters;
1690 curveParams->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1691 tag1 = BDecTag (b, seqBytesDecoded, env);
1692 }
1693 else
1694 {
1695 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1696 SnaccExcep::throwMe(-139);
1697 }
1698
1699 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
1700 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
1701 {
1702 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1703 plusX.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1704 tag1 = BDecTag (b, seqBytesDecoded, env);
1705 }
1706 else
1707 {
1708 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1709 SnaccExcep::throwMe(-140);
1710 }
1711
1712 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
1713 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
1714 {
1715 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1716 minusX.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1717 if (seqBytesDecoded == elmtLen0)
1718 {
1719 bytesDecoded += seqBytesDecoded;
1720 return;
1721 }
1722 else
1723 {
1724 tag1 = BDecTag (b, seqBytesDecoded, env);
1725
1726 if ((elmtLen0 == INDEFINITE_LEN) && (tag1 == EOC_TAG_ID))
1727 {
1728 BDEC_2ND_EOC_OCTET (b, seqBytesDecoded, env)
1729 bytesDecoded += seqBytesDecoded;
1730 return;
1731 }
1732 }
1733 }
1734 else
1735 {
1736 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1737 SnaccExcep::throwMe(-141);
1738 }
1739
1740 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
1741 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
1742 {
1743 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1744 plusY = new BigIntegerStr;
1745 plusY->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1746 }
1747
1748 bytesDecoded += seqBytesDecoded;
1749 if (elmtLen0 == INDEFINITE_LEN)
1750 {
1751 BDecEoc (b, bytesDecoded, env);
1752 return;
1753 }
1754 else if (seqBytesDecoded != elmtLen0)
1755 {
1756 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
1757 SnaccExcep::throwMe(-142);
1758 }
1759 else
1760 return;
1761 } // FEEPublicKey::BDecContent
1762
1763 AsnLen FEEPublicKey::BEnc (BUF_TYPE b)
1764 {
1765 AsnLen l;
1766 l = BEncContent (b);
1767 l += BEncConsLen (b, l);
1768 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
1769 return l;
1770 }
1771
1772 void FEEPublicKey::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
1773 {
1774 AsnTag tag;
1775 AsnLen elmtLen1;
1776
1777 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
1778 {
1779 Asn1Error << "FEEPublicKey::BDec: ERROR - wrong tag" << endl;
1780 SnaccExcep::throwMe(-143);
1781 }
1782 elmtLen1 = BDecLen (b, bytesDecoded, env);
1783 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
1784 }
1785
1786 void FEEPublicKey::Print (ostream &os) const
1787 {
1788 #ifndef NDEBUG
1789 os << "{ -- SEQUENCE --" << endl;
1790 indentG += stdIndentG;
1791
1792 {
1793 Indent (os, indentG);
1794 os << "version ";
1795 os << version;
1796 os << "," << endl;
1797 }
1798
1799 if (NOT_NULL (curveParams))
1800 {
1801 Indent (os, indentG);
1802 os << "curveParams ";
1803 os << *curveParams;
1804 }
1805 else
1806 {
1807 Indent (os, indentG);
1808 os << "curveParams ";
1809 os << "-- void --";
1810 os << "," << endl;
1811 }
1812
1813 {
1814 Indent (os, indentG);
1815 os << "plusX ";
1816 os << plusX;
1817 os << "," << endl;
1818 }
1819
1820 {
1821 Indent (os, indentG);
1822 os << "minusX ";
1823 os << minusX;
1824 os << "," << endl;
1825 }
1826
1827 if (NOT_NULL (plusY))
1828 {
1829 os << ","<< endl;
1830 Indent (os, indentG);
1831 os << "plusY ";
1832 os << *plusY;
1833 }
1834 else
1835 {
1836 Indent (os, indentG);
1837 os << "plusY ";
1838 os << "-- void --";
1839 os << endl;
1840 }
1841
1842 os << endl;
1843 indentG -= stdIndentG;
1844 Indent (os, indentG);
1845 os << "}";
1846 #endif /* NDEBUG */
1847 } // FEEPublicKey::Print
1848
1849
1850 FEEPrivateKey::FEEPrivateKey()
1851 {
1852 #if TCL
1853 curveParams = new FEECurveParameters;
1854 #else
1855 curveParams = NULL; // incomplete initialization of mandatory element!
1856 #endif // TCL
1857 }
1858
1859 FEEPrivateKey::FEEPrivateKey (const FEEPrivateKey &)
1860 {
1861 Asn1Error << "use of incompletely defined FEEPrivateKey::FEEPrivateKey (const FEEPrivateKey &)" << endl;
1862 abort();
1863 }
1864
1865 FEEPrivateKey::~FEEPrivateKey()
1866 {
1867 delete curveParams;
1868 }
1869
1870 AsnType *FEEPrivateKey::Clone() const
1871 {
1872 return new FEEPrivateKey;
1873 }
1874
1875 AsnType *FEEPrivateKey::Copy() const
1876 {
1877 return new FEEPrivateKey (*this);
1878 }
1879
1880 #if SNACC_DEEP_COPY
1881 FEEPrivateKey &FEEPrivateKey::operator = (const FEEPrivateKey &that)
1882 #else // SNACC_DEEP_COPY
1883 FEEPrivateKey &FEEPrivateKey::operator = (const FEEPrivateKey &)
1884 #endif // SNACC_DEEP_COPY
1885 {
1886 #if SNACC_DEEP_COPY
1887 if (this != &that)
1888 {
1889 version = that.version;
1890 if (that.curveParams)
1891 {
1892 if (!curveParams)
1893 curveParams = new FEECurveParameters;
1894 *curveParams = *that.curveParams;
1895 }
1896 else
1897 {
1898 delete curveParams;
1899 curveParams = NULL;
1900 }
1901 privData = that.privData;
1902 }
1903
1904 return *this;
1905 #else // SNACC_DEEP_COPY
1906 Asn1Error << "use of incompletely defined FEEPrivateKey &FEEPrivateKey::operator = (const FEEPrivateKey &)" << endl;
1907 abort();
1908 // if your compiler complains here, check the -novolat option
1909 #endif // SNACC_DEEP_COPY
1910 }
1911
1912 AsnLen
1913 FEEPrivateKey::BEncContent (BUF_TYPE b)
1914 {
1915 AsnLen totalLen = 0;
1916 AsnLen l;
1917
1918 l = privData.BEncContent (b);
1919 l += BEncDefLen (b, l);
1920
1921 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
1922 totalLen += l;
1923
1924 BEncEocIfNec (b);
1925 l = curveParams->BEncContent (b);
1926 l += BEncConsLen (b, l);
1927
1928 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
1929 totalLen += l;
1930
1931 l = version.BEncContent (b);
1932 BEncDefLenTo127 (b, l);
1933 l++;
1934
1935 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
1936 totalLen += l;
1937
1938 return totalLen;
1939 } // FEEPrivateKey::BEncContent
1940
1941
1942 void FEEPrivateKey::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
1943 {
1944 AsnTag tag1;
1945 AsnLen seqBytesDecoded = 0;
1946 AsnLen elmtLen1;
1947 tag1 = BDecTag (b, seqBytesDecoded, env);
1948
1949 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))
1950 {
1951 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1952 version.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1953 tag1 = BDecTag (b, seqBytesDecoded, env);
1954 }
1955 else
1956 {
1957 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1958 SnaccExcep::throwMe(-144);
1959 }
1960
1961 if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
1962 {
1963 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1964 curveParams = new FEECurveParameters;
1965 curveParams->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1966 tag1 = BDecTag (b, seqBytesDecoded, env);
1967 }
1968 else
1969 {
1970 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1971 SnaccExcep::throwMe(-145);
1972 }
1973
1974 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
1975 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
1976 {
1977 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
1978 privData.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
1979 }
1980 else
1981 {
1982 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
1983 SnaccExcep::throwMe(-146);
1984 }
1985
1986 bytesDecoded += seqBytesDecoded;
1987 if (elmtLen0 == INDEFINITE_LEN)
1988 {
1989 BDecEoc (b, bytesDecoded, env);
1990 return;
1991 }
1992 else if (seqBytesDecoded != elmtLen0)
1993 {
1994 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
1995 SnaccExcep::throwMe(-147);
1996 }
1997 else
1998 return;
1999 } // FEEPrivateKey::BDecContent
2000
2001 AsnLen FEEPrivateKey::BEnc (BUF_TYPE b)
2002 {
2003 AsnLen l;
2004 l = BEncContent (b);
2005 l += BEncConsLen (b, l);
2006 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
2007 return l;
2008 }
2009
2010 void FEEPrivateKey::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
2011 {
2012 AsnTag tag;
2013 AsnLen elmtLen1;
2014
2015 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
2016 {
2017 Asn1Error << "FEEPrivateKey::BDec: ERROR - wrong tag" << endl;
2018 SnaccExcep::throwMe(-148);
2019 }
2020 elmtLen1 = BDecLen (b, bytesDecoded, env);
2021 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
2022 }
2023
2024 void FEEPrivateKey::Print (ostream &os) const
2025 {
2026 #ifndef NDEBUG
2027 os << "{ -- SEQUENCE --" << endl;
2028 indentG += stdIndentG;
2029
2030 {
2031 Indent (os, indentG);
2032 os << "version ";
2033 os << version;
2034 os << "," << endl;
2035 }
2036
2037 if (NOT_NULL (curveParams))
2038 {
2039 Indent (os, indentG);
2040 os << "curveParams ";
2041 os << *curveParams;
2042 }
2043 else
2044 {
2045 Indent (os, indentG);
2046 os << "curveParams ";
2047 os << "-- void --";
2048 os << "," << endl;
2049 }
2050
2051 {
2052 Indent (os, indentG);
2053 os << "privData ";
2054 os << privData;
2055 }
2056
2057 os << endl;
2058 indentG -= stdIndentG;
2059 Indent (os, indentG);
2060 os << "}";
2061 #endif /* NDEBUG */
2062 } // FEEPrivateKey::Print
2063
2064
2065 DSAPrivateKey::DSAPrivateKey()
2066 {
2067 #if TCL
2068 dsaAlg = new DSAAlgorithmId;
2069 #else
2070 dsaAlg = NULL; // incomplete initialization of mandatory element!
2071 #endif // TCL
2072 }
2073
2074 DSAPrivateKey::DSAPrivateKey (const DSAPrivateKey &)
2075 {
2076 Asn1Error << "use of incompletely defined DSAPrivateKey::DSAPrivateKey (const DSAPrivateKey &)" << endl;
2077 abort();
2078 }
2079
2080 DSAPrivateKey::~DSAPrivateKey()
2081 {
2082 delete dsaAlg;
2083 }
2084
2085 AsnType *DSAPrivateKey::Clone() const
2086 {
2087 return new DSAPrivateKey;
2088 }
2089
2090 AsnType *DSAPrivateKey::Copy() const
2091 {
2092 return new DSAPrivateKey (*this);
2093 }
2094
2095 #if SNACC_DEEP_COPY
2096 DSAPrivateKey &DSAPrivateKey::operator = (const DSAPrivateKey &that)
2097 #else // SNACC_DEEP_COPY
2098 DSAPrivateKey &DSAPrivateKey::operator = (const DSAPrivateKey &)
2099 #endif // SNACC_DEEP_COPY
2100 {
2101 #if SNACC_DEEP_COPY
2102 if (this != &that)
2103 {
2104 version = that.version;
2105 if (that.dsaAlg)
2106 {
2107 if (!dsaAlg)
2108 dsaAlg = new DSAAlgorithmId;
2109 *dsaAlg = *that.dsaAlg;
2110 }
2111 else
2112 {
2113 delete dsaAlg;
2114 dsaAlg = NULL;
2115 }
2116 privateKey = that.privateKey;
2117 }
2118
2119 return *this;
2120 #else // SNACC_DEEP_COPY
2121 Asn1Error << "use of incompletely defined DSAPrivateKey &DSAPrivateKey::operator = (const DSAPrivateKey &)" << endl;
2122 abort();
2123 // if your compiler complains here, check the -novolat option
2124 #endif // SNACC_DEEP_COPY
2125 }
2126
2127 AsnLen
2128 DSAPrivateKey::BEncContent (BUF_TYPE b)
2129 {
2130 AsnLen totalLen = 0;
2131 AsnLen l;
2132
2133 l = privateKey.BEncContent (b);
2134 l += BEncDefLen (b, l);
2135
2136 l += BEncTag1 (b, UNIV, PRIM, OCTETSTRING_TAG_CODE);
2137 totalLen += l;
2138
2139 BEncEocIfNec (b);
2140 l = dsaAlg->BEncContent (b);
2141 l += BEncConsLen (b, l);
2142
2143 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
2144 totalLen += l;
2145
2146 l = version.BEncContent (b);
2147 BEncDefLenTo127 (b, l);
2148 l++;
2149
2150 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
2151 totalLen += l;
2152
2153 return totalLen;
2154 } // DSAPrivateKey::BEncContent
2155
2156
2157 void DSAPrivateKey::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
2158 {
2159 AsnTag tag1;
2160 AsnLen seqBytesDecoded = 0;
2161 AsnLen elmtLen1;
2162 tag1 = BDecTag (b, seqBytesDecoded, env);
2163
2164 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE)))
2165 {
2166 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
2167 version.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
2168 tag1 = BDecTag (b, seqBytesDecoded, env);
2169 }
2170 else
2171 {
2172 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
2173 SnaccExcep::throwMe(-149);
2174 }
2175
2176 if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
2177 {
2178 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
2179 dsaAlg = new DSAAlgorithmId;
2180 dsaAlg->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
2181 tag1 = BDecTag (b, seqBytesDecoded, env);
2182 }
2183 else
2184 {
2185 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
2186 SnaccExcep::throwMe(-150);
2187 }
2188
2189 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, OCTETSTRING_TAG_CODE))
2190 || (tag1 == MAKE_TAG_ID (UNIV, CONS, OCTETSTRING_TAG_CODE)))
2191 {
2192 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
2193 privateKey.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
2194 }
2195 else
2196 {
2197 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
2198 SnaccExcep::throwMe(-151);
2199 }
2200
2201 bytesDecoded += seqBytesDecoded;
2202 if (elmtLen0 == INDEFINITE_LEN)
2203 {
2204 BDecEoc (b, bytesDecoded, env);
2205 return;
2206 }
2207 else if (seqBytesDecoded != elmtLen0)
2208 {
2209 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
2210 SnaccExcep::throwMe(-152);
2211 }
2212 else
2213 return;
2214 } // DSAPrivateKey::BDecContent
2215
2216 AsnLen DSAPrivateKey::BEnc (BUF_TYPE b)
2217 {
2218 AsnLen l;
2219 l = BEncContent (b);
2220 l += BEncConsLen (b, l);
2221 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
2222 return l;
2223 }
2224
2225 void DSAPrivateKey::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
2226 {
2227 AsnTag tag;
2228 AsnLen elmtLen1;
2229
2230 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
2231 {
2232 Asn1Error << "DSAPrivateKey::BDec: ERROR - wrong tag" << endl;
2233 SnaccExcep::throwMe(-153);
2234 }
2235 elmtLen1 = BDecLen (b, bytesDecoded, env);
2236 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
2237 }
2238
2239 void DSAPrivateKey::Print (ostream &os) const
2240 {
2241 #ifndef NDEBUG
2242 os << "{ -- SEQUENCE --" << endl;
2243 indentG += stdIndentG;
2244
2245 {
2246 Indent (os, indentG);
2247 os << "version ";
2248 os << version;
2249 os << "," << endl;
2250 }
2251
2252 if (NOT_NULL (dsaAlg))
2253 {
2254 Indent (os, indentG);
2255 os << "dsaAlg ";
2256 os << *dsaAlg;
2257 }
2258 else
2259 {
2260 Indent (os, indentG);
2261 os << "dsaAlg ";
2262 os << "-- void --";
2263 os << "," << endl;
2264 }
2265
2266 {
2267 Indent (os, indentG);
2268 os << "privateKey ";
2269 os << privateKey;
2270 }
2271
2272 os << endl;
2273 indentG -= stdIndentG;
2274 Indent (os, indentG);
2275 os << "}";
2276 #endif /* NDEBUG */
2277 } // DSAPrivateKey::Print
2278
2279
2280 DSAPublicKey::DSAPublicKey()
2281 {
2282 #if TCL
2283 dsaAlg = new DSAAlgorithmId;
2284 #else
2285 dsaAlg = NULL; // incomplete initialization of mandatory element!
2286 #endif // TCL
2287 }
2288
2289 DSAPublicKey::DSAPublicKey (const DSAPublicKey &)
2290 {
2291 Asn1Error << "use of incompletely defined DSAPublicKey::DSAPublicKey (const DSAPublicKey &)" << endl;
2292 abort();
2293 }
2294
2295 DSAPublicKey::~DSAPublicKey()
2296 {
2297 delete dsaAlg;
2298 }
2299
2300 AsnType *DSAPublicKey::Clone() const
2301 {
2302 return new DSAPublicKey;
2303 }
2304
2305 AsnType *DSAPublicKey::Copy() const
2306 {
2307 return new DSAPublicKey (*this);
2308 }
2309
2310 #if SNACC_DEEP_COPY
2311 DSAPublicKey &DSAPublicKey::operator = (const DSAPublicKey &that)
2312 #else // SNACC_DEEP_COPY
2313 DSAPublicKey &DSAPublicKey::operator = (const DSAPublicKey &)
2314 #endif // SNACC_DEEP_COPY
2315 {
2316 #if SNACC_DEEP_COPY
2317 if (this != &that)
2318 {
2319 if (that.dsaAlg)
2320 {
2321 if (!dsaAlg)
2322 dsaAlg = new DSAAlgorithmId;
2323 *dsaAlg = *that.dsaAlg;
2324 }
2325 else
2326 {
2327 delete dsaAlg;
2328 dsaAlg = NULL;
2329 }
2330 publicKey = that.publicKey;
2331 }
2332
2333 return *this;
2334 #else // SNACC_DEEP_COPY
2335 Asn1Error << "use of incompletely defined DSAPublicKey &DSAPublicKey::operator = (const DSAPublicKey &)" << endl;
2336 abort();
2337 // if your compiler complains here, check the -novolat option
2338 #endif // SNACC_DEEP_COPY
2339 }
2340
2341 AsnLen
2342 DSAPublicKey::BEncContent (BUF_TYPE b)
2343 {
2344 AsnLen totalLen = 0;
2345 AsnLen l;
2346
2347 l = publicKey.BEncContent (b);
2348 l += BEncDefLen (b, l);
2349
2350 l += BEncTag1 (b, UNIV, PRIM, BITSTRING_TAG_CODE);
2351 totalLen += l;
2352
2353 BEncEocIfNec (b);
2354 l = dsaAlg->BEncContent (b);
2355 l += BEncConsLen (b, l);
2356
2357 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
2358 totalLen += l;
2359
2360 return totalLen;
2361 } // DSAPublicKey::BEncContent
2362
2363
2364 void DSAPublicKey::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
2365 {
2366 AsnTag tag1;
2367 AsnLen seqBytesDecoded = 0;
2368 AsnLen elmtLen1;
2369 tag1 = BDecTag (b, seqBytesDecoded, env);
2370
2371 if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
2372 {
2373 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
2374 dsaAlg = new DSAAlgorithmId;
2375 dsaAlg->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
2376 tag1 = BDecTag (b, seqBytesDecoded, env);
2377 }
2378 else
2379 {
2380 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
2381 SnaccExcep::throwMe(-154);
2382 }
2383
2384 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, BITSTRING_TAG_CODE))
2385 || (tag1 == MAKE_TAG_ID (UNIV, CONS, BITSTRING_TAG_CODE)))
2386 {
2387 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
2388 publicKey.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
2389 }
2390 else
2391 {
2392 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
2393 SnaccExcep::throwMe(-155);
2394 }
2395
2396 bytesDecoded += seqBytesDecoded;
2397 if (elmtLen0 == INDEFINITE_LEN)
2398 {
2399 BDecEoc (b, bytesDecoded, env);
2400 return;
2401 }
2402 else if (seqBytesDecoded != elmtLen0)
2403 {
2404 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
2405 SnaccExcep::throwMe(-156);
2406 }
2407 else
2408 return;
2409 } // DSAPublicKey::BDecContent
2410
2411 AsnLen DSAPublicKey::BEnc (BUF_TYPE b)
2412 {
2413 AsnLen l;
2414 l = BEncContent (b);
2415 l += BEncConsLen (b, l);
2416 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
2417 return l;
2418 }
2419
2420 void DSAPublicKey::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
2421 {
2422 AsnTag tag;
2423 AsnLen elmtLen1;
2424
2425 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
2426 {
2427 Asn1Error << "DSAPublicKey::BDec: ERROR - wrong tag" << endl;
2428 SnaccExcep::throwMe(-157);
2429 }
2430 elmtLen1 = BDecLen (b, bytesDecoded, env);
2431 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
2432 }
2433
2434 void DSAPublicKey::Print (ostream &os) const
2435 {
2436 #ifndef NDEBUG
2437 os << "{ -- SEQUENCE --" << endl;
2438 indentG += stdIndentG;
2439
2440 if (NOT_NULL (dsaAlg))
2441 {
2442 Indent (os, indentG);
2443 os << "dsaAlg ";
2444 os << *dsaAlg;
2445 }
2446 else
2447 {
2448 Indent (os, indentG);
2449 os << "dsaAlg ";
2450 os << "-- void --";
2451 os << "," << endl;
2452 }
2453
2454 {
2455 Indent (os, indentG);
2456 os << "publicKey ";
2457 os << publicKey;
2458 }
2459
2460 os << endl;
2461 indentG -= stdIndentG;
2462 Indent (os, indentG);
2463 os << "}";
2464 #endif /* NDEBUG */
2465 } // DSAPublicKey::Print
2466
2467
2468 DSAPrivateKeyOcts::DSAPrivateKeyOcts()
2469 {
2470 }
2471
2472 DSAPrivateKeyOcts::DSAPrivateKeyOcts (const DSAPrivateKeyOcts &)
2473 {
2474 Asn1Error << "use of incompletely defined DSAPrivateKeyOcts::DSAPrivateKeyOcts (const DSAPrivateKeyOcts &)" << endl;
2475 abort();
2476 }
2477
2478 DSAPrivateKeyOcts::~DSAPrivateKeyOcts()
2479 {
2480 }
2481
2482 AsnType *DSAPrivateKeyOcts::Clone() const
2483 {
2484 return new DSAPrivateKeyOcts;
2485 }
2486
2487 AsnType *DSAPrivateKeyOcts::Copy() const
2488 {
2489 return new DSAPrivateKeyOcts (*this);
2490 }
2491
2492 #if SNACC_DEEP_COPY
2493 DSAPrivateKeyOcts &DSAPrivateKeyOcts::operator = (const DSAPrivateKeyOcts &that)
2494 #else // SNACC_DEEP_COPY
2495 DSAPrivateKeyOcts &DSAPrivateKeyOcts::operator = (const DSAPrivateKeyOcts &)
2496 #endif // SNACC_DEEP_COPY
2497 {
2498 #if SNACC_DEEP_COPY
2499 if (this != &that)
2500 {
2501 privateKey = that.privateKey;
2502 }
2503
2504 return *this;
2505 #else // SNACC_DEEP_COPY
2506 Asn1Error << "use of incompletely defined DSAPrivateKeyOcts &DSAPrivateKeyOcts::operator = (const DSAPrivateKeyOcts &)" << endl;
2507 abort();
2508 // if your compiler complains here, check the -novolat option
2509 #endif // SNACC_DEEP_COPY
2510 }
2511
2512 AsnLen
2513 DSAPrivateKeyOcts::BEncContent (BUF_TYPE b)
2514 {
2515 AsnLen totalLen = 0;
2516 AsnLen l;
2517
2518 l = privateKey.BEncContent (b);
2519 l += BEncDefLen (b, l);
2520
2521 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
2522 totalLen += l;
2523
2524 return totalLen;
2525 } // DSAPrivateKeyOcts::BEncContent
2526
2527
2528 void DSAPrivateKeyOcts::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
2529 {
2530 AsnTag tag1;
2531 AsnLen seqBytesDecoded = 0;
2532 AsnLen elmtLen1;
2533 tag1 = BDecTag (b, seqBytesDecoded, env);
2534
2535 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
2536 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
2537 {
2538 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
2539 privateKey.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
2540 }
2541 else
2542 {
2543 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
2544 SnaccExcep::throwMe(-158);
2545 }
2546
2547 bytesDecoded += seqBytesDecoded;
2548 if (elmtLen0 == INDEFINITE_LEN)
2549 {
2550 BDecEoc (b, bytesDecoded, env);
2551 return;
2552 }
2553 else if (seqBytesDecoded != elmtLen0)
2554 {
2555 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
2556 SnaccExcep::throwMe(-159);
2557 }
2558 else
2559 return;
2560 } // DSAPrivateKeyOcts::BDecContent
2561
2562 AsnLen DSAPrivateKeyOcts::BEnc (BUF_TYPE b)
2563 {
2564 AsnLen l;
2565 l = BEncContent (b);
2566 l += BEncConsLen (b, l);
2567 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
2568 return l;
2569 }
2570
2571 void DSAPrivateKeyOcts::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
2572 {
2573 AsnTag tag;
2574 AsnLen elmtLen1;
2575
2576 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
2577 {
2578 Asn1Error << "DSAPrivateKeyOcts::BDec: ERROR - wrong tag" << endl;
2579 SnaccExcep::throwMe(-160);
2580 }
2581 elmtLen1 = BDecLen (b, bytesDecoded, env);
2582 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
2583 }
2584
2585 void DSAPrivateKeyOcts::Print (ostream &os) const
2586 {
2587 #ifndef NDEBUG
2588 os << "{ -- SEQUENCE --" << endl;
2589 indentG += stdIndentG;
2590
2591 {
2592 Indent (os, indentG);
2593 os << "privateKey ";
2594 os << privateKey;
2595 }
2596
2597 os << endl;
2598 indentG -= stdIndentG;
2599 Indent (os, indentG);
2600 os << "}";
2601 #endif /* NDEBUG */
2602 } // DSAPrivateKeyOcts::Print
2603
2604
2605 DSASignature::DSASignature()
2606 {
2607 }
2608
2609 DSASignature::DSASignature (const DSASignature &)
2610 {
2611 Asn1Error << "use of incompletely defined DSASignature::DSASignature (const DSASignature &)" << endl;
2612 abort();
2613 }
2614
2615 DSASignature::~DSASignature()
2616 {
2617 }
2618
2619 AsnType *DSASignature::Clone() const
2620 {
2621 return new DSASignature;
2622 }
2623
2624 AsnType *DSASignature::Copy() const
2625 {
2626 return new DSASignature (*this);
2627 }
2628
2629 #if SNACC_DEEP_COPY
2630 DSASignature &DSASignature::operator = (const DSASignature &that)
2631 #else // SNACC_DEEP_COPY
2632 DSASignature &DSASignature::operator = (const DSASignature &)
2633 #endif // SNACC_DEEP_COPY
2634 {
2635 #if SNACC_DEEP_COPY
2636 if (this != &that)
2637 {
2638 r = that.r;
2639 s = that.s;
2640 }
2641
2642 return *this;
2643 #else // SNACC_DEEP_COPY
2644 Asn1Error << "use of incompletely defined DSASignature &DSASignature::operator = (const DSASignature &)" << endl;
2645 abort();
2646 // if your compiler complains here, check the -novolat option
2647 #endif // SNACC_DEEP_COPY
2648 }
2649
2650 AsnLen
2651 DSASignature::BEncContent (BUF_TYPE b)
2652 {
2653 AsnLen totalLen = 0;
2654 AsnLen l;
2655
2656 l = s.BEncContent (b);
2657 l += BEncDefLen (b, l);
2658
2659 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
2660 totalLen += l;
2661
2662 l = r.BEncContent (b);
2663 l += BEncDefLen (b, l);
2664
2665 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
2666 totalLen += l;
2667
2668 return totalLen;
2669 } // DSASignature::BEncContent
2670
2671
2672 void DSASignature::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
2673 {
2674 AsnTag tag1;
2675 AsnLen seqBytesDecoded = 0;
2676 AsnLen elmtLen1;
2677 tag1 = BDecTag (b, seqBytesDecoded, env);
2678
2679 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
2680 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
2681 {
2682 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
2683 r.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
2684 tag1 = BDecTag (b, seqBytesDecoded, env);
2685 }
2686 else
2687 {
2688 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
2689 SnaccExcep::throwMe(-161);
2690 }
2691
2692 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
2693 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
2694 {
2695 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
2696 s.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
2697 }
2698 else
2699 {
2700 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
2701 SnaccExcep::throwMe(-162);
2702 }
2703
2704 bytesDecoded += seqBytesDecoded;
2705 if (elmtLen0 == INDEFINITE_LEN)
2706 {
2707 BDecEoc (b, bytesDecoded, env);
2708 return;
2709 }
2710 else if (seqBytesDecoded != elmtLen0)
2711 {
2712 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
2713 SnaccExcep::throwMe(-163);
2714 }
2715 else
2716 return;
2717 } // DSASignature::BDecContent
2718
2719 AsnLen DSASignature::BEnc (BUF_TYPE b)
2720 {
2721 AsnLen l;
2722 l = BEncContent (b);
2723 l += BEncConsLen (b, l);
2724 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
2725 return l;
2726 }
2727
2728 void DSASignature::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
2729 {
2730 AsnTag tag;
2731 AsnLen elmtLen1;
2732
2733 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
2734 {
2735 Asn1Error << "DSASignature::BDec: ERROR - wrong tag" << endl;
2736 SnaccExcep::throwMe(-164);
2737 }
2738 elmtLen1 = BDecLen (b, bytesDecoded, env);
2739 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
2740 }
2741
2742 void DSASignature::Print (ostream &os) const
2743 {
2744 #ifndef NDEBUG
2745 os << "{ -- SEQUENCE --" << endl;
2746 indentG += stdIndentG;
2747
2748 {
2749 Indent (os, indentG);
2750 os << "r ";
2751 os << r;
2752 os << "," << endl;
2753 }
2754
2755 {
2756 Indent (os, indentG);
2757 os << "s ";
2758 os << s;
2759 }
2760
2761 os << endl;
2762 indentG -= stdIndentG;
2763 Indent (os, indentG);
2764 os << "}";
2765 #endif /* NDEBUG */
2766 } // DSASignature::Print
2767
2768
2769 DSAAlgParams::DSAAlgParams()
2770 {
2771 }
2772
2773 DSAAlgParams::DSAAlgParams (const DSAAlgParams &)
2774 {
2775 Asn1Error << "use of incompletely defined DSAAlgParams::DSAAlgParams (const DSAAlgParams &)" << endl;
2776 abort();
2777 }
2778
2779 DSAAlgParams::~DSAAlgParams()
2780 {
2781 }
2782
2783 AsnType *DSAAlgParams::Clone() const
2784 {
2785 return new DSAAlgParams;
2786 }
2787
2788 AsnType *DSAAlgParams::Copy() const
2789 {
2790 return new DSAAlgParams (*this);
2791 }
2792
2793 #if SNACC_DEEP_COPY
2794 DSAAlgParams &DSAAlgParams::operator = (const DSAAlgParams &that)
2795 #else // SNACC_DEEP_COPY
2796 DSAAlgParams &DSAAlgParams::operator = (const DSAAlgParams &)
2797 #endif // SNACC_DEEP_COPY
2798 {
2799 #if SNACC_DEEP_COPY
2800 if (this != &that)
2801 {
2802 p = that.p;
2803 q = that.q;
2804 g = that.g;
2805 }
2806
2807 return *this;
2808 #else // SNACC_DEEP_COPY
2809 Asn1Error << "use of incompletely defined DSAAlgParams &DSAAlgParams::operator = (const DSAAlgParams &)" << endl;
2810 abort();
2811 // if your compiler complains here, check the -novolat option
2812 #endif // SNACC_DEEP_COPY
2813 }
2814
2815 AsnLen
2816 DSAAlgParams::BEncContent (BUF_TYPE b)
2817 {
2818 AsnLen totalLen = 0;
2819 AsnLen l;
2820
2821 l = g.BEncContent (b);
2822 l += BEncDefLen (b, l);
2823
2824 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
2825 totalLen += l;
2826
2827 l = q.BEncContent (b);
2828 l += BEncDefLen (b, l);
2829
2830 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
2831 totalLen += l;
2832
2833 l = p.BEncContent (b);
2834 l += BEncDefLen (b, l);
2835
2836 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
2837 totalLen += l;
2838
2839 return totalLen;
2840 } // DSAAlgParams::BEncContent
2841
2842
2843 void DSAAlgParams::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
2844 {
2845 AsnTag tag1;
2846 AsnLen seqBytesDecoded = 0;
2847 AsnLen elmtLen1;
2848 tag1 = BDecTag (b, seqBytesDecoded, env);
2849
2850 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
2851 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
2852 {
2853 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
2854 p.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
2855 tag1 = BDecTag (b, seqBytesDecoded, env);
2856 }
2857 else
2858 {
2859 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
2860 SnaccExcep::throwMe(-165);
2861 }
2862
2863 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
2864 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
2865 {
2866 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
2867 q.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
2868 tag1 = BDecTag (b, seqBytesDecoded, env);
2869 }
2870 else
2871 {
2872 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
2873 SnaccExcep::throwMe(-166);
2874 }
2875
2876 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
2877 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
2878 {
2879 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
2880 g.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
2881 }
2882 else
2883 {
2884 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
2885 SnaccExcep::throwMe(-167);
2886 }
2887
2888 bytesDecoded += seqBytesDecoded;
2889 if (elmtLen0 == INDEFINITE_LEN)
2890 {
2891 BDecEoc (b, bytesDecoded, env);
2892 return;
2893 }
2894 else if (seqBytesDecoded != elmtLen0)
2895 {
2896 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
2897 SnaccExcep::throwMe(-168);
2898 }
2899 else
2900 return;
2901 } // DSAAlgParams::BDecContent
2902
2903 AsnLen DSAAlgParams::BEnc (BUF_TYPE b)
2904 {
2905 AsnLen l;
2906 l = BEncContent (b);
2907 l += BEncConsLen (b, l);
2908 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
2909 return l;
2910 }
2911
2912 void DSAAlgParams::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
2913 {
2914 AsnTag tag;
2915 AsnLen elmtLen1;
2916
2917 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
2918 {
2919 Asn1Error << "DSAAlgParams::BDec: ERROR - wrong tag" << endl;
2920 SnaccExcep::throwMe(-169);
2921 }
2922 elmtLen1 = BDecLen (b, bytesDecoded, env);
2923 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
2924 }
2925
2926 void DSAAlgParams::Print (ostream &os) const
2927 {
2928 #ifndef NDEBUG
2929 os << "{ -- SEQUENCE --" << endl;
2930 indentG += stdIndentG;
2931
2932 {
2933 Indent (os, indentG);
2934 os << "p ";
2935 os << p;
2936 os << "," << endl;
2937 }
2938
2939 {
2940 Indent (os, indentG);
2941 os << "q ";
2942 os << q;
2943 os << "," << endl;
2944 }
2945
2946 {
2947 Indent (os, indentG);
2948 os << "g ";
2949 os << g;
2950 }
2951
2952 os << endl;
2953 indentG -= stdIndentG;
2954 Indent (os, indentG);
2955 os << "}";
2956 #endif /* NDEBUG */
2957 } // DSAAlgParams::Print
2958
2959
2960 DHPrivateKey::DHPrivateKey()
2961 {
2962 #if TCL
2963 params = new DHParameter;
2964 #else
2965 params = NULL; // incomplete initialization of mandatory element!
2966 #endif // TCL
2967 }
2968
2969 DHPrivateKey::DHPrivateKey (const DHPrivateKey &)
2970 {
2971 Asn1Error << "use of incompletely defined DHPrivateKey::DHPrivateKey (const DHPrivateKey &)" << endl;
2972 abort();
2973 }
2974
2975 DHPrivateKey::~DHPrivateKey()
2976 {
2977 delete params;
2978 }
2979
2980 AsnType *DHPrivateKey::Clone() const
2981 {
2982 return new DHPrivateKey;
2983 }
2984
2985 AsnType *DHPrivateKey::Copy() const
2986 {
2987 return new DHPrivateKey (*this);
2988 }
2989
2990 #if SNACC_DEEP_COPY
2991 DHPrivateKey &DHPrivateKey::operator = (const DHPrivateKey &that)
2992 #else // SNACC_DEEP_COPY
2993 DHPrivateKey &DHPrivateKey::operator = (const DHPrivateKey &)
2994 #endif // SNACC_DEEP_COPY
2995 {
2996 #if SNACC_DEEP_COPY
2997 if (this != &that)
2998 {
2999 dHOid = that.dHOid;
3000 if (that.params)
3001 {
3002 if (!params)
3003 params = new DHParameter;
3004 *params = *that.params;
3005 }
3006 else
3007 {
3008 delete params;
3009 params = NULL;
3010 }
3011 secretPart = that.secretPart;
3012 }
3013
3014 return *this;
3015 #else // SNACC_DEEP_COPY
3016 Asn1Error << "use of incompletely defined DHPrivateKey &DHPrivateKey::operator = (const DHPrivateKey &)" << endl;
3017 abort();
3018 // if your compiler complains here, check the -novolat option
3019 #endif // SNACC_DEEP_COPY
3020 }
3021
3022 AsnLen
3023 DHPrivateKey::BEncContent (BUF_TYPE b)
3024 {
3025 AsnLen totalLen = 0;
3026 AsnLen l;
3027
3028 l = secretPart.BEncContent (b);
3029 l += BEncDefLen (b, l);
3030
3031 l += BEncTag1 (b, UNIV, PRIM, INTEGER_TAG_CODE);
3032 totalLen += l;
3033
3034 BEncEocIfNec (b);
3035 l = params->BEncContent (b);
3036 l += BEncConsLen (b, l);
3037
3038 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
3039 totalLen += l;
3040
3041 l = dHOid.BEncContent (b);
3042 l += BEncDefLen (b, l);
3043
3044 l += BEncTag1 (b, UNIV, PRIM, OID_TAG_CODE);
3045 totalLen += l;
3046
3047 return totalLen;
3048 } // DHPrivateKey::BEncContent
3049
3050
3051 void DHPrivateKey::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
3052 {
3053 AsnTag tag1;
3054 AsnLen seqBytesDecoded = 0;
3055 AsnLen elmtLen1;
3056 tag1 = BDecTag (b, seqBytesDecoded, env);
3057
3058 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, OID_TAG_CODE)))
3059 {
3060 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
3061 dHOid.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
3062 tag1 = BDecTag (b, seqBytesDecoded, env);
3063 }
3064 else
3065 {
3066 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
3067 SnaccExcep::throwMe(-170);
3068 }
3069
3070 if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
3071 {
3072 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
3073 params = new DHParameter;
3074 params->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
3075 tag1 = BDecTag (b, seqBytesDecoded, env);
3076 }
3077 else
3078 {
3079 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
3080 SnaccExcep::throwMe(-171);
3081 }
3082
3083 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, INTEGER_TAG_CODE))
3084 || (tag1 == MAKE_TAG_ID (UNIV, CONS, INTEGER_TAG_CODE)))
3085 {
3086 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
3087 secretPart.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
3088 }
3089 else
3090 {
3091 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
3092 SnaccExcep::throwMe(-172);
3093 }
3094
3095 bytesDecoded += seqBytesDecoded;
3096 if (elmtLen0 == INDEFINITE_LEN)
3097 {
3098 BDecEoc (b, bytesDecoded, env);
3099 return;
3100 }
3101 else if (seqBytesDecoded != elmtLen0)
3102 {
3103 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
3104 SnaccExcep::throwMe(-173);
3105 }
3106 else
3107 return;
3108 } // DHPrivateKey::BDecContent
3109
3110 AsnLen DHPrivateKey::BEnc (BUF_TYPE b)
3111 {
3112 AsnLen l;
3113 l = BEncContent (b);
3114 l += BEncConsLen (b, l);
3115 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
3116 return l;
3117 }
3118
3119 void DHPrivateKey::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
3120 {
3121 AsnTag tag;
3122 AsnLen elmtLen1;
3123
3124 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
3125 {
3126 Asn1Error << "DHPrivateKey::BDec: ERROR - wrong tag" << endl;
3127 SnaccExcep::throwMe(-174);
3128 }
3129 elmtLen1 = BDecLen (b, bytesDecoded, env);
3130 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
3131 }
3132
3133 void DHPrivateKey::Print (ostream &os) const
3134 {
3135 #ifndef NDEBUG
3136 os << "{ -- SEQUENCE --" << endl;
3137 indentG += stdIndentG;
3138
3139 {
3140 Indent (os, indentG);
3141 os << "dHOid ";
3142 os << dHOid;
3143 os << "," << endl;
3144 }
3145
3146 if (NOT_NULL (params))
3147 {
3148 Indent (os, indentG);
3149 os << "params ";
3150 os << *params;
3151 }
3152 else
3153 {
3154 Indent (os, indentG);
3155 os << "params ";
3156 os << "-- void --";
3157 os << "," << endl;
3158 }
3159
3160 {
3161 Indent (os, indentG);
3162 os << "secretPart ";
3163 os << secretPart;
3164 }
3165
3166 os << endl;
3167 indentG -= stdIndentG;
3168 Indent (os, indentG);
3169 os << "}";
3170 #endif /* NDEBUG */
3171 } // DHPrivateKey::Print
3172
3173
3174 DHParameterBlock::DHParameterBlock()
3175 {
3176 #if TCL
3177 params = new DHParameter;
3178 #else
3179 params = NULL; // incomplete initialization of mandatory element!
3180 #endif // TCL
3181 }
3182
3183 DHParameterBlock::DHParameterBlock (const DHParameterBlock &)
3184 {
3185 Asn1Error << "use of incompletely defined DHParameterBlock::DHParameterBlock (const DHParameterBlock &)" << endl;
3186 abort();
3187 }
3188
3189 DHParameterBlock::~DHParameterBlock()
3190 {
3191 delete params;
3192 }
3193
3194 AsnType *DHParameterBlock::Clone() const
3195 {
3196 return new DHParameterBlock;
3197 }
3198
3199 AsnType *DHParameterBlock::Copy() const
3200 {
3201 return new DHParameterBlock (*this);
3202 }
3203
3204 #if SNACC_DEEP_COPY
3205 DHParameterBlock &DHParameterBlock::operator = (const DHParameterBlock &that)
3206 #else // SNACC_DEEP_COPY
3207 DHParameterBlock &DHParameterBlock::operator = (const DHParameterBlock &)
3208 #endif // SNACC_DEEP_COPY
3209 {
3210 #if SNACC_DEEP_COPY
3211 if (this != &that)
3212 {
3213 oid = that.oid;
3214 if (that.params)
3215 {
3216 if (!params)
3217 params = new DHParameter;
3218 *params = *that.params;
3219 }
3220 else
3221 {
3222 delete params;
3223 params = NULL;
3224 }
3225 }
3226
3227 return *this;
3228 #else // SNACC_DEEP_COPY
3229 Asn1Error << "use of incompletely defined DHParameterBlock &DHParameterBlock::operator = (const DHParameterBlock &)" << endl;
3230 abort();
3231 // if your compiler complains here, check the -novolat option
3232 #endif // SNACC_DEEP_COPY
3233 }
3234
3235 AsnLen
3236 DHParameterBlock::BEncContent (BUF_TYPE b)
3237 {
3238 AsnLen totalLen = 0;
3239 AsnLen l;
3240
3241 BEncEocIfNec (b);
3242 l = params->BEncContent (b);
3243 l += BEncConsLen (b, l);
3244
3245 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
3246 totalLen += l;
3247
3248 l = oid.BEncContent (b);
3249 l += BEncDefLen (b, l);
3250
3251 l += BEncTag1 (b, UNIV, PRIM, OID_TAG_CODE);
3252 totalLen += l;
3253
3254 return totalLen;
3255 } // DHParameterBlock::BEncContent
3256
3257
3258 void DHParameterBlock::BDecContent (BUF_TYPE b, AsnTag /*tag0*/, AsnLen elmtLen0, AsnLen &bytesDecoded, ENV_TYPE env)
3259 {
3260 AsnTag tag1;
3261 AsnLen seqBytesDecoded = 0;
3262 AsnLen elmtLen1;
3263 tag1 = BDecTag (b, seqBytesDecoded, env);
3264
3265 if ((tag1 == MAKE_TAG_ID (UNIV, PRIM, OID_TAG_CODE)))
3266 {
3267 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
3268 oid.BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
3269 tag1 = BDecTag (b, seqBytesDecoded, env);
3270 }
3271 else
3272 {
3273 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
3274 SnaccExcep::throwMe(-175);
3275 }
3276
3277 if ((tag1 == MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE)))
3278 {
3279 elmtLen1 = BDecLen (b, seqBytesDecoded, env);
3280 params = new DHParameter;
3281 params->BDecContent (b, tag1, elmtLen1, seqBytesDecoded, env);
3282 }
3283 else
3284 {
3285 Asn1Error << "ERROR - SEQUENCE is missing non-optional elmt." << endl;
3286 SnaccExcep::throwMe(-176);
3287 }
3288
3289 bytesDecoded += seqBytesDecoded;
3290 if (elmtLen0 == INDEFINITE_LEN)
3291 {
3292 BDecEoc (b, bytesDecoded, env);
3293 return;
3294 }
3295 else if (seqBytesDecoded != elmtLen0)
3296 {
3297 Asn1Error << "ERROR - Length discrepancy on sequence." << endl;
3298 SnaccExcep::throwMe(-177);
3299 }
3300 else
3301 return;
3302 } // DHParameterBlock::BDecContent
3303
3304 AsnLen DHParameterBlock::BEnc (BUF_TYPE b)
3305 {
3306 AsnLen l;
3307 l = BEncContent (b);
3308 l += BEncConsLen (b, l);
3309 l += BEncTag1 (b, UNIV, CONS, SEQ_TAG_CODE);
3310 return l;
3311 }
3312
3313 void DHParameterBlock::BDec (BUF_TYPE b, AsnLen &bytesDecoded, ENV_TYPE env)
3314 {
3315 AsnTag tag;
3316 AsnLen elmtLen1;
3317
3318 if ((tag = BDecTag (b, bytesDecoded, env)) != MAKE_TAG_ID (UNIV, CONS, SEQ_TAG_CODE))
3319 {
3320 Asn1Error << "DHParameterBlock::BDec: ERROR - wrong tag" << endl;
3321 SnaccExcep::throwMe(-178);
3322 }
3323 elmtLen1 = BDecLen (b, bytesDecoded, env);
3324 BDecContent (b, tag, elmtLen1, bytesDecoded, env);
3325 }
3326
3327 void DHParameterBlock::Print (ostream &os) const
3328 {
3329 #ifndef NDEBUG
3330 os << "{ -- SEQUENCE --" << endl;
3331 indentG += stdIndentG;
3332
3333 {
3334 Indent (os, indentG);
3335 os << "oid ";
3336 os << oid;
3337 os << "," << endl;
3338 }
3339
3340 if (NOT_NULL (params))
3341 {
3342 Indent (os, indentG);
3343 os << "params ";
3344 os << *params;
3345 }
3346 else
3347 {
3348 Indent (os, indentG);
3349 os << "params ";
3350 os << "-- void --";
3351 os << endl;
3352 }
3353
3354 os << endl;
3355 indentG -= stdIndentG;
3356 Indent (os, indentG);
3357 os << "}";
3358 #endif /* NDEBUG */
3359 } // DHParameterBlock::Print
3360
3361