// Path: lib/src/main/java/com/google/capillary/NoSuchKeyException.java
// public final class NoSuchKeyException extends CapillaryException {
// 
//   /**
//    * Creates a new {@link NoSuchKeyException} object.
//    *
//    * @param msg the exception message.
//    */
//   public NoSuchKeyException(String msg) {
//     super(msg);
//   }
// }


import java.security.UnrecoverableKeyException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import com.google.capillary.NoSuchKeyException;
import java.security.GeneralSecurityException;
import java.security.InvalidAlgorithmParameterException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
  @Test
  public void testGenerateKeyPair()
      throws KeyStoreException,
      InvalidAlgorithmParameterException,
      NoSuchAlgorithmException,
      NoSuchProviderException {
    String keychainId1 = KEYCHAIN_ID;
    final String keychainId2 = "keychain 2";

    assertEquals(0, keyStore.size());

    AndroidKeyStoreRsaUtils.generateKeyPair(context, keychainId1, false);
    assertEquals(1, keyStore.size());

    AndroidKeyStoreRsaUtils.generateKeyPair(context, keychainId1, true);
    assertEquals(2, keyStore.size());

    AndroidKeyStoreRsaUtils.generateKeyPair(context, keychainId2, false);
    assertEquals(3, keyStore.size());

    AndroidKeyStoreRsaUtils.generateKeyPair(context, keychainId2, true);
    assertEquals(4, keyStore.size());
  }

  @Test
  public void testGetPublicKey()
      throws KeyStoreException,
      InvalidAlgorithmParameterException,
      NoSuchAlgorithmException,
      NoSuchProviderException,
// Path: lib/src/main/java/com/google/capillary/NoSuchKeyException.java
// public final class NoSuchKeyException extends CapillaryException {
// 
//   /**
//    * Creates a new {@link NoSuchKeyException} object.
//    *
//    * @param msg the exception message.
//    */
//   public NoSuchKeyException(String msg) {
//     super(msg);
//   }
// }


// Path: lib-android/src/androidTest/java/com/google/capillary/android/AndroidKeyStoreRsaUtilsAndroidTest.java
import java.security.UnrecoverableKeyException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import com.google.capillary.NoSuchKeyException;
import java.security.GeneralSecurityException;
import java.security.InvalidAlgorithmParameterException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;

  @Test
  public void testGenerateKeyPair()
      throws KeyStoreException,
      InvalidAlgorithmParameterException,
      NoSuchAlgorithmException,
      NoSuchProviderException {
    String keychainId1 = KEYCHAIN_ID;
    final String keychainId2 = "keychain 2";

    assertEquals(0, keyStore.size());

    AndroidKeyStoreRsaUtils.generateKeyPair(context, keychainId1, false);
    assertEquals(1, keyStore.size());

    AndroidKeyStoreRsaUtils.generateKeyPair(context, keychainId1, true);
    assertEquals(2, keyStore.size());

    AndroidKeyStoreRsaUtils.generateKeyPair(context, keychainId2, false);
    assertEquals(3, keyStore.size());

    AndroidKeyStoreRsaUtils.generateKeyPair(context, keychainId2, true);
    assertEquals(4, keyStore.size());
  }

  @Test
  public void testGetPublicKey()
      throws KeyStoreException,
      InvalidAlgorithmParameterException,
      NoSuchAlgorithmException,
      NoSuchProviderException,
      NoSuchKeyException {