process algo OID by summing, return it
| 637 | |
| 638 | // process algo OID by summing, return it |
| 639 | word32 CertDecoder::GetAlgoId() |
| 640 | { |
| 641 | if (source_.GetError().What()) return 0; |
| 642 | word32 length = GetSequence(); |
| 643 | |
| 644 | if (source_.GetError().What()) return 0; |
| 645 | |
| 646 | byte b = source_.next(); |
| 647 | if (b != OBJECT_IDENTIFIER) { |
| 648 | source_.SetError(OBJECT_ID_E); |
| 649 | return 0; |
| 650 | } |
| 651 | |
| 652 | length = GetLength(source_); |
| 653 | if (source_.IsLeft(length) == false) return 0; |
| 654 | |
| 655 | word32 oid = 0; |
| 656 | while(length--) |
| 657 | oid += source_.next(); // just sum it up for now |
| 658 | |
| 659 | // could have NULL tag and 0 terminator, but may not |
| 660 | b = source_.next(); |
| 661 | if (b == TAG_NULL) { |
| 662 | b = source_.next(); |
| 663 | if (b != 0) { |
| 664 | source_.SetError(EXPECT_0_E); |
| 665 | return 0; |
| 666 | } |
| 667 | } |
| 668 | else |
| 669 | // go back, didn't have it |
| 670 | b = source_.prev(); |
| 671 | |
| 672 | return oid; |
| 673 | } |
| 674 | |
| 675 | |
| 676 | // read cert signature, store in signature_ |