Generate an optimal intermediate certificate chain