read cert signature, store in signature_
| 675 | |
| 676 | // read cert signature, store in signature_ |
| 677 | word32 CertDecoder::GetSignature() |
| 678 | { |
| 679 | if (source_.GetError().What()) return 0; |
| 680 | byte b = source_.next(); |
| 681 | |
| 682 | if (b != BIT_STRING) { |
| 683 | source_.SetError(BIT_STR_E); |
| 684 | return 0; |
| 685 | } |
| 686 | |
| 687 | sigLength_ = GetLength(source_); |
| 688 | if (sigLength_ <= 1 || source_.IsLeft(sigLength_) == false) { |
| 689 | source_.SetError(CONTENT_E); |
| 690 | return 0; |
| 691 | } |
| 692 | |
| 693 | b = source_.next(); |
| 694 | if (b != 0) { |
| 695 | source_.SetError(EXPECT_0_E); |
| 696 | return 0; |
| 697 | } |
| 698 | sigLength_--; |
| 699 | |
| 700 | signature_ = NEW_TC byte[sigLength_]; |
| 701 | memcpy(signature_, source_.get_current(), sigLength_); |
| 702 | source_.advance(sigLength_); |
| 703 | |
| 704 | return sigLength_; |
| 705 | } |
| 706 | |
| 707 | |
| 708 | // read cert digest, store in signature_ |