src/lib/GenericASN1ContentHandler.h
branchv_0
changeset 35 bf2c546f49d1
parent 31 a87c97aecbf6
child 38 44ee477875ec
equal deleted inserted replaced
34:c15dc8762bdb 35:bf2c546f49d1
   115 		handlers.writeStartElement("date-time");
   115 		handlers.writeStartElement("date-time");
   116 		handlers.writeCharacters(value.toString());
   116 		handlers.writeCharacters(value.toString());
   117 		handlers.writeEndElement();
   117 		handlers.writeEndElement();
   118 	}
   118 	}
   119 
   119 
       
   120 	void writeSpecific(const Header& header, std::string value) override {
       
   121 		std::stringstream hex;
       
   122 		hex << std::hex << std::setfill('0');
       
   123 		for (uint8_t b : value) hex << std::setw(2) << (int) b;
       
   124 
       
   125 		std::stringstream ascii;
       
   126 		for (uint8_t b : value) ascii << (b >= 32 && b < 127 ? (char) b : '.'); // TODO: configurable unsupported symbol?
       
   127 
       
   128 		handlers.writeStartElement("specific",{"length", std::to_string(value.size()), "hex", hex.str()});
       
   129 		handlers.writeCharacters(ascii.str());
       
   130 		handlers.writeEndElement();
       
   131 	}
       
   132 
       
   133 
   120 };
   134 };
   121 
   135 
   122 }
   136 }
   123 }
   137 }
   124 }
   138 }