Make ClientCertStoreNSS use_byte_certs-friendly.

Also introduces:
x509_util::CreateX509CertificateFromCERTCertificate

And extracts GetDEREncoded from x509_certificate_nss.cc.

Bug: 671420
Change-Id: I5b604ad380f466de35322bc81c20b5ce3932f541
Reviewed-on: https://chromium-review.googlesource.com/611311
Commit-Queue: Matt Mueller <[email protected]>
Reviewed-by: David Benjamin <[email protected]>
Cr-Commit-Position: refs/heads/master@{#495419}
diff --git a/net/test/cert_test_util.h b/net/test/cert_test_util.h
index f5b104b1..1369265 100644
--- a/net/test/cert_test_util.h
+++ b/net/test/cert_test_util.h
@@ -15,6 +15,8 @@
 #if defined(USE_NSS_CERTS)
 // From <pk11pub.h>
 typedef struct PK11SlotInfoStr PK11SlotInfo;
+
+#include "net/cert/scoped_nss_types.h"
 #endif
 
 namespace base {
@@ -33,13 +35,20 @@
                                 const std::string& key_filename,
                                 PK11SlotInfo* slot);
 
-bool ImportClientCertToSlot(const scoped_refptr<X509Certificate>& cert,
-                            PK11SlotInfo* slot);
+ScopedCERTCertificate ImportClientCertToSlot(
+    const scoped_refptr<X509Certificate>& cert,
+    PK11SlotInfo* slot);
 
 scoped_refptr<X509Certificate> ImportClientCertAndKeyFromFile(
     const base::FilePath& dir,
     const std::string& cert_filename,
     const std::string& key_filename,
+    PK11SlotInfo* slot,
+    ScopedCERTCertificate* nss_cert);
+scoped_refptr<X509Certificate> ImportClientCertAndKeyFromFile(
+    const base::FilePath& dir,
+    const std::string& cert_filename,
+    const std::string& key_filename,
     PK11SlotInfo* slot);
 #endif