diff --git a/validat0.cpp b/validat0.cpp index 56c3e159..b872aff1 100644 --- a/validat0.cpp +++ b/validat0.cpp @@ -1251,11 +1251,48 @@ bool TestRounding() #if defined(CRYPTOPP_EXTENDED_VALIDATION) struct ASN1_TestTuple { + ASN1_TestTuple(int _disposition, int _tag, const char* _data, size_t _len) { + disposition = _disposition; + tag = _tag; + data = std::string(_data, _len); + } + + std::string Name() const { + return Id2String(); + } + + const byte* Data() const { + return reinterpret_cast(&data[0]); + } + + size_t Size() const { + return data.size(); + } + + std::string Id2String() const + { + switch(tag) + { + case BIT_STRING: + return "BIT_STRING"; + case OCTET_STRING: + return "OCTET_STRING"; + case INTEGER: + return "INTEGER"; + case UTF8_STRING: + return "UTF8_STRING"; + case PRINTABLE_STRING: + return "PRINTABLE_STRING"; + case IA5_STRING: + return "IA5_STRING"; + default: + return "Unknown"; + } + } + + std::string data; int disposition; - int identifier; - const char* name; - const char* data; - size_t len; + int tag; }; bool RunASN1TestSet(const ASN1_TestTuple asnTuples[], size_t count) @@ -1268,8 +1305,8 @@ bool RunASN1TestSet(const ASN1_TestTuple asnTuples[], size_t count) for(size_t i=0; i