code: public static void verifyKeystoreContent(KeyStore keystore) throws KeystoreException {
  		try {
  			int numberOfCertificates = 0;
  			Enumeration<String> aliases = keystore.aliases();
  			while (aliases.hasMoreElements()) {
  				String alias = aliases.nextElement();
  				Certificate certificate = keystore.getCertificate(alias);
  				if (certificate instanceof X509Certificate) {
  					X509Certificate xcert = (X509Certificate) certificate;
  					numberOfCertificates++;
  
  					/* Check validity dates */
  					xcert.checkValidity();
  
  					/* Check issuer */
  					boolean issuerIsApple = xcert.getIssuerDN().toString().contains("Apple");
  					if (!issuerIsApple) throw new KeystoreException("Certificate was not issued by Apple." + REVIEW_MESSAGE);
  
  					/* Check certificate key usage */
  					boolean[] keyUsage = xcert.getKeyUsage();
  					if (!keyUsage[0]) throw new KeystoreException("Certificate usage is incorrect." + REVIEW_MESSAGE);
  
  				}
  			}
  			if (numberOfCertificates == 0) throw new KeystoreException("Keystore does not contain any valid certificate." + REVIEW_MESSAGE);
  			if (numberOfCertificates > 1) throw new KeystoreException("Keystore contains too many certificates." + REVIEW_MESSAGE);
  
  		} catch (KeystoreException e) {
  			throw e;
  		} catch (CertificateExpiredException e) {
  			throw new KeystoreException("Certificate is expired. A new one must be issued.", e);
  		} catch (CertificateNotYetValidException e) {
  			throw new KeystoreException("Certificate is not yet valid. Wait until the validity period is reached or issue a new certificate.", e);
  		} catch (Exception e) {
  			/* We ignore any other exception, as we do not want to interrupt the process because of an error we did not expect. */
  		}
  	}
docs: Perform basic tests on a keystore to detect common user mistakes (experimental).
  If a problem is found, a KeystoreException is thrown.
  If no problem is found, this method simply returns without exceptions.
  
  @param keystore a keystore to verify
  @throws KeystoreException thrown if a problem was detected