diff --git a/lib/utils/x509.py b/lib/utils/x509.py
index fc01ce3fb8271596ece118f3a43e5234579b0559..c1fa52e17e3844933a059ca13cc683fc0555664e 100644
--- a/lib/utils/x509.py
+++ b/lib/utils/x509.py
@@ -334,7 +334,7 @@ def PrepareX509CertKeyCheck(cert, key):
 
   """
   ctx = OpenSSL.SSL.Context(OpenSSL.SSL.TLSv1_METHOD)
-  ctx.use_certificate(cert)
   ctx.use_privatekey(key)
+  ctx.use_certificate(cert)
 
   return ctx.check_privatekey