121 |
122 |
122 if (!started) { |
123 if (!started) { |
123 handlers.writeStreamStart(); |
124 handlers.writeStreamStart(); |
124 started = true; |
125 started = true; |
125 } |
126 } |
126 |
127 |
127 // TODO: check tagClass and pc |
128 // TODO: check tagClass and pc |
128 |
129 |
129 // TODO: constants, more types |
130 // TODO: constants, more types |
130 if (typeHeader.tag == 0) handlers.writeCollectionEnd(); |
131 if (typeHeader.tag == 0 && typeHeader.tagClass == TagClass::Universal && typeHeader.pc == PC::Primitive) { |
131 else if (typeHeader.tag == 16) { |
132 handlers.writeCollectionEnd(); |
|
133 } else if (typeHeader.tag == 16) { |
132 level.push_back({typeHeader.definiteLength, typeHeader.length, getBytesRead()}); // TODO: transaction |
134 level.push_back({typeHeader.definiteLength, typeHeader.length, getBytesRead()}); // TODO: transaction |
133 handlers.writeCollectionStart(ASN1ContentHandler::CollectionType::Sequence); |
135 handlers.writeCollectionStart(ASN1ContentHandler::CollectionType::Sequence); |
134 } else if (typeHeader.tag == 17) { |
136 } else if (typeHeader.tag == 17) { |
135 level.push_back({typeHeader.definiteLength, typeHeader.length, getBytesRead()}); // TODO: transaction |
137 level.push_back({typeHeader.definiteLength, typeHeader.length, getBytesRead()}); // TODO: transaction |
136 handlers.writeCollectionStart(ASN1ContentHandler::CollectionType::Set); |
138 handlers.writeCollectionStart(ASN1ContentHandler::CollectionType::Set); |
|
139 } else if (typeHeader.pc == PC::Constructed) { |
|
140 level.push_back({typeHeader.definiteLength, typeHeader.length, getBytesRead()}); // TODO: transaction |
|
141 handlers.writeCollectionStart(ASN1ContentHandler::CollectionType::Constructed); |
137 } else if (typeHeader.tag == 5 && typeHeader.length == 0) { |
142 } else if (typeHeader.tag == 5 && typeHeader.length == 0) { |
138 handlers.writeNull(); |
143 handlers.writeNull(); |
139 } else if (typeHeader.tag == 1) { |
144 } else if (typeHeader.tag == 1) { |
140 bool value; |
145 bool value; |
141 read((uint8_t*) & value, 1); |
146 read((uint8_t*) & value, 1); |