Account for null client certificate

If a null certificate is passed to setClientKeyEntry() we should
not pass a non-null array with a single null element to the
setClientKeyEntryWithCertificateChain helper method.  Instead we
should pass a null array.

Cherry-pick of 410a3498ac

Bug: 34765004
Test: cts-tradefed run cts -d --module CtsNetTestCases --test android.net.wifi.cts.WifiEnterpriseConfigTest
Change-Id: I02793b4b29bc7325f98833c58bf652ba68353827
This commit is contained in:
Paul Stewart
2017-01-27 09:37:17 -08:00
parent 291ddaef78
commit 1ca57a1d10

View File

@@ -752,8 +752,11 @@ public class WifiEnterpriseConfig implements Parcelable {
* @throws IllegalArgumentException for an invalid key or certificate.
*/
public void setClientKeyEntry(PrivateKey privateKey, X509Certificate clientCertificate) {
setClientKeyEntryWithCertificateChain(privateKey,
new X509Certificate[] {clientCertificate});
X509Certificate[] clientCertificates = null;
if (clientCertificate != null) {
clientCertificates = new X509Certificate[] {clientCertificate};
}
setClientKeyEntryWithCertificateChain(privateKey, clientCertificates);
}
/**