title: keyStore.getKey(alias, password) returns NULL
body: <p>I need sign some string message, but <code>keyStore.getKey()</code> returns null.<br>
  What I did:<br>
  I imported certificate:  </p>
  
  <pre><code>keytool -importcert -file cert.cer -keystore cert.jks -alias "cert"
  </code></pre>
  
  <p>My java code:</p>
  
  <pre><code>KeyStore keyStore = KeyStore.getInstance(this.keystoretype);
  File keyStoreFile = ResourceUtils.getFile("classpath:kkb/"+keystoreFileName);
  FileInputStream keyStoreFileInputStream = new FileInputStream(keyStoreFile.getPath());
  keyStore.load(keyStoreFileInputStream, storePassArray);
  Signature signature = Signature.getInstance(this.signalgorythm);
  PrivateKey privateKey = (PrivateKey)keyStore.getKey(alias, keypassArray);
  </code></pre>
  
  <p><code>getKey()</code> returns null because this line code in the JavaKeyStore class, engineGetKey method:</p>
  
  <pre><code>public Key engineGetKey(String alias, char[] password)
          throws NoSuchAlgorithmException, UnrecoverableKeyException
  {
      Object entry = entries.get(convertAlias(alias));
      if (entry == null || !(entry instanceof KeyEntry)) {
          return null;
  }
  </code></pre>
  
  <p>Condition "instanceof" return false, because "entry" object of class "JavaKeyStore$TrustedCertEntry".
  What I do wrong? Can you help me?</p>