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
410a3498ac28dccf69212d94a533040893c7ce0c
Bug:
34765004
Test: cts-tradefed run cts -d --module CtsNetTestCases --test android.net.wifi.cts.WifiEnterpriseConfigTest
Change-Id: I02793b4b29bc7325f98833c58bf652ba68353827
* @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);
}
/**