title: KeyPairGenerator.generateKeyPair() in Android 7.1.1
body: <p>We have seen an influx of the following exceptions and only for Android 7.1.1 (API 25). Has something changed in 7.1.1 to make this fail? </p>
  
  <pre><code>java.security.ProviderException: Failed to load generated key pair from keystore
      at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.loadKeystoreKeyPair(AndroidKeyStoreKeyPairGeneratorSpi.java:518)
      at android.security.keystore.AndroidKeyStoreKeyPairGeneratorSpi.generateKeyPair(AndroidKeyStoreKeyPairGeneratorSpi.java:470)
  </code></pre>
  
  <p>Sanitized code below (may have slight copy paste bugs)</p>
  
  <pre><code> KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", "AndroidKeyStore");
      String certInfo = String.format(Locale.ROOT, "CN=%s, OU=%s", new Object[]{"KeyName", context.getPackageName()});
    generator.initialize(new KeyPairGeneratorSpec.Builder(context)).setAlias("KeyName").setSubject(new X500Principal(certInfo)).setSerialNumber(BigInteger.ONE).setStartDate(start).setEndDate(end).build());
    generator.generateKeyPair();
  </code></pre>