process a Date, either BEFORE or AFTER
| 863 | |
| 864 | // process a Date, either BEFORE or AFTER |
| 865 | void CertDecoder::GetDate(DateType dt) |
| 866 | { |
| 867 | if (source_.GetError().What()) return; |
| 868 | |
| 869 | byte b = source_.next(); |
| 870 | if (b != UTC_TIME && b != GENERALIZED_TIME) { |
| 871 | source_.SetError(TIME_E); |
| 872 | return; |
| 873 | } |
| 874 | |
| 875 | word32 length = GetLength(source_); |
| 876 | if (source_.IsLeft(length) == false) return; |
| 877 | |
| 878 | byte date[MAX_DATE_SZ]; |
| 879 | if (length > MAX_DATE_SZ || length < MIN_DATE_SZ) { |
| 880 | source_.SetError(DATE_SZ_E); |
| 881 | return; |
| 882 | } |
| 883 | |
| 884 | memcpy(date, source_.get_current(), length); |
| 885 | source_.advance(length); |
| 886 | |
| 887 | if (!ValidateDate(date, b, dt) && verify_) { |
| 888 | if (dt == BEFORE) |
| 889 | source_.SetError(BEFORE_DATE_E); |
| 890 | else |
| 891 | source_.SetError(AFTER_DATE_E); |
| 892 | } |
| 893 | |
| 894 | // save for later use |
| 895 | if (dt == BEFORE) { |
| 896 | memcpy(beforeDate_, date, length); |
| 897 | beforeDate_[length] = 0; |
| 898 | beforeDateType_= b; |
| 899 | } |
| 900 | else { // after |
| 901 | memcpy(afterDate_, date, length); |
| 902 | afterDate_[length] = 0; |
| 903 | afterDateType_= b; |
| 904 | } |
| 905 | } |
| 906 | |
| 907 | |
| 908 | void CertDecoder::GetValidity() |
nothing calls this directly
no test coverage detected