public static KeyStore loadAppleKeychain() throws CryptoException {
  if (!isAppleKeychainSupported()) {
    throw new CryptoException(res.getString("AppleKeychainNotSupported.exception.message"));
  }
  KeyStore keyStore=null;
  try {
    keyStore=KeyStore.getInstance(KEYCHAIN.jce(),APPLE.jce());
  }
 catch (  KeyStoreException ex) {
    throw new CryptoException(MessageFormat.format(res.getString("NoCreateKeyStore.exception.message"),KEYCHAIN.jce()),ex);
  }
catch (  NoSuchProviderException ex) {
    throw new CryptoException(MessageFormat.format(res.getString("NoCreateKeyStore.exception.message"),KEYCHAIN.jce()),ex);
  }
  try {
    keyStore.load(null,null);
  }
 catch (  NoSuchAlgorithmException ex) {
    throw new CryptoException(MessageFormat.format(res.getString("NoLoadKeyStoreType.exception.message"),KEYCHAIN.jce()),ex);
  }
catch (  CertificateException ex) {
    throw new CryptoException(MessageFormat.format(res.getString("NoLoadKeyStoreType.exception.message"),KEYCHAIN.jce()),ex);
  }
catch (  IOException ex) {
    throw new CryptoException(MessageFormat.format(res.getString("NoLoadKeyStoreType.exception.message"),KEYCHAIN.jce()),ex);
  }
  return keyStore;
}

public static KeyStore loadAppleKeychain ( ) throws CryptoException { if ( ! isAppleKeychainSupported ( ) ) { throw new CryptoException ( res . getString ( "AppleKeychainNotSupported.exception.message" ) ) ; } KeyStore keyStore = null ; try { keyStore = KeyStore . getInstance ( KEYCHAIN . jce ( ) , APPLE . jce ( ) ) ; } catch ( KeyStoreException ex ) { throw new CryptoException ( MessageFormat . format ( res . getString ( "NoCreateKeyStore.exception.message" ) , KEYCHAIN . jce ( ) ) , ex ) ; } catch ( NoSuchProviderException ex ) { throw new CryptoException ( MessageFormat . format ( res . getString ( "NoCreateKeyStore.exception.message" ) , KEYCHAIN . jce ( ) ) , ex ) ; } try { keyStore . load ( null , null ) ; } catch ( NoSuchAlgorithmException ex ) { throw new CryptoException ( MessageFormat . format ( res . getString ( "NoLoadKeyStoreType.exception.message" ) , KEYCHAIN . jce ( ) ) , ex ) ; } catch ( CertificateException ex ) { throw new CryptoException ( MessageFormat . format ( res . getString ( "NoLoadKeyStoreType.exception.message" ) , KEYCHAIN . jce ( ) ) , ex ) ; } catch ( IOException ex ) { throw new CryptoException ( MessageFormat . format ( res . getString ( "NoLoadKeyStoreType.exception.message" ) , KEYCHAIN . jce ( ) ) , ex ) ; } return keyStore ; }
load the apple keychain as a keystore . the keystore is not file based and therefore does not need to be saved .
