40 const size_t total_size =
make_uint32(0, buf[0], buf[1], buf[2]);
42 if(total_size != buf.size() - 3) {
47 if(max_size > 0 && total_size > max_size) {
48 throw Decoding_Error(
"Certificate chain exceeds policy specified maximum size");
51 const uint8_t* certs = buf.data() + 3;
53 while(
const size_t remaining_bytes = buf.data() + buf.size() - certs) {
54 if(remaining_bytes < 3) {
58 const size_t cert_size =
make_uint32(0, certs[0], certs[1], certs[2]);
60 if(remaining_bytes < (3 + cert_size)) {
67 certs += cert_size + 3;
77 if(!m_certs.empty() && m_certs[0].x509_version() != 3) {
78 throw TLS_Exception(Alert::BadCertificate,
"The leaf certificate must be v3");