36 const size_t total_size =
make_uint32(0, buf[0], buf[1], buf[2]);
38 if(total_size != buf.size() - 3) {
43 if(max_size > 0 && total_size > max_size) {
44 throw Decoding_Error(
"Certificate chain exceeds policy specified maximum size");
47 const uint8_t* certs = buf.data() + 3;
49 while(
size_t remaining_bytes = buf.data() + buf.size() - certs) {
50 if(remaining_bytes < 3) {
54 const size_t cert_size =
make_uint32(0, certs[0], certs[1], certs[2]);
56 if(remaining_bytes < (3 + cert_size)) {
63 certs += cert_size + 3;
73 if(!m_certs.empty() && m_certs[0].x509_version() != 3) {
74 throw TLS_Exception(Alert::BadCertificate,
"The leaf certificate must be v3");