added check for null encoding on private key (github
@@ -667,10 +667,17 @@ public void engineSetKeyEntry(
Certificate[] chain)
throws KeyStoreException
{
- if ((key instanceof PrivateKey) && (chain == null))
+ if ((key instanceof PrivateKey))
+ {
+ if (chain == null)
{
throw new KeyStoreException("no certificate chain for private key");
}
+ if (key.getEncoded() == null)
+ {
+ throw new KeyStoreException("cannot store protected private key");
+ }
+ }
try
{
