code: public KeyStore.Entry engineGetEntry(String alias,
                          KeyStore.ProtectionParameter protParam)
                  throws KeyStoreException, NoSuchAlgorithmException,
                  UnrecoverableEntryException {
  
          if (!engineContainsAlias(alias)) {
              return null;
          }
  
          if (protParam != null &&
                  !(protParam instanceof KeyStore.PasswordProtection)) {
              throw new UnsupportedOperationException();
          }
  
          if (engineIsCertificateEntry(alias)) {
              if (protParam == null) {
                  return new KeyStore.TrustedCertificateEntry
                          (engineGetCertificate(alias));
              } else {
                  throw new UnsupportedOperationException
                      ("trusted certificate entries are not password-protected");
              }
          } else if (engineIsKeyEntry(alias)) {
            char[] password = null;
            if (protParam != null) {
                KeyStore.PasswordProtection pp =
                        (KeyStore.PasswordProtection)protParam;
                password = pp.getPassword();
            }
            Key key = engineGetKey(alias, password);
            if (key instanceof PrivateKey) {
                Certificate[] chain = engineGetCertificateChain(alias);
                return new KeyStore.PrivateKeyEntry((PrivateKey)key, chain);
            } else if (key instanceof SecretKey) {
                return new KeyStore.SecretKeyEntry((SecretKey)key);
            }
          }
          throw new UnsupportedOperationException();
      }
docs: Gets a {@code KeyStore.Entry} for the specified alias
  with the specified protection parameter.
  
  @param alias get the {@code KeyStore.Entry} for this alias
  @param protParam the {@code ProtectionParameter}
  used to protect the {@code Entry},
  which may be {@code null}
  
  @return the {@code KeyStore.Entry} for the specified alias,
  or {@code null} if there is no such entry
  
  @exception KeyStoreException if the operation failed
  @exception NoSuchAlgorithmException if the algorithm for recovering the
  entry cannot be found
  @exception UnrecoverableEntryException if the specified
  {@code protParam} were insufficient or invalid
  @exception UnrecoverableKeyException if the entry is a
  {@code PrivateKeyEntry} or {@code SecretKeyEntry}
  and the specified {@code protParam} does not contain
  the information needed to recover the key (e.g. wrong password)
  
  @since 1.5