Hello can you show how you were able to retrieve the PrivateKey from the 
KeyStore?  I am getting the same error like the one you mentioned above.

Observation-
setClientKeyEntry method throws exception- 
java.lang.IllegalArgumentException: Private key cannot be encoded.
setClientKeyEntry method throws this exception if getEncoded method returns 
null for the PrivateKey object reference.
It is not clear why getEncoded returns null in this case.

On Tuesday, February 25, 2014 at 8:18:46 PM UTC-8, Pradeep Phatak wrote:
>
>  
> setClientKeyEntry API worked after I retrieved X509Certificate and 
> PrivateKey from the KeyStore. The cert and key looked okay in the 
> WifiConfiguration.
>  
> Adding wifi network failed with the error below-
> E/WifiConfigStore(764): "8021x-wpa2-ssid" invalid config for key 
> installation
> E/WifiConfigStore(764): Failed to set a network variable, removed network: 
> 12
>
> On Tuesday, February 25, 2014 8:31:17 AM UTC-8, Nikolay Elenkov wrote:
>
>> On Wed, Feb 26, 2014 at 1:18 AM, Pradeep Phatak 
>> <[email protected]> wrote: 
>> > 
>> > The alias is provided when we use the Keychain createInstallIntent API 
>> to 
>> > store the p12 in the Android KeyStore. 
>> > As you correctly noted in your earlier post, we can't retrieve the 
>> Private 
>> > Key in that case. 
>> > The only other method I found to load a p12 certificate in Keystore was 
>> the 
>> > load method. But, it doesn't take any alias as parameter. 
>> > How do I pass the alias while loading the certificate in the keystore? 
>> > 
>>
>> Do read the JavaDoc of the KeyStore class before proceeding: 
>>
>> https://developer.android.com/reference/java/security/KeyStore.html 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/969646c4-4a53-4a51-910f-48d23e75feae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to