/**
  * Creates a {@link javax.crypto.Cipher} instance from a {@link javax.crypto.CipherSpi}.
  *
  * @param cipherSpi the {@link javax.cyrpto.CipherSpi} instance
  * @param transformation the transformation cipherSpi was obtained for
  * @return a {@link javax.crypto.Cipher} instance
  * @throws Throwable in case of an error
  */
 private static Cipher getCipher(final CipherSpi cipherSpi, final String transformation)
     throws Throwable {
   /* This API isn't public - usually you're expected to simply use Cipher.getInstance().
    * Due to the signed-jar restriction for JCE providers that is not an option, so we
    * use one of the private constructors of Cipher.
    */
   final Class<Cipher> cipherClass = Cipher.class;
   final Constructor<Cipher> cipherConstructor =
       cipherClass.getDeclaredConstructor(CipherSpi.class, String.class);
   cipherConstructor.setAccessible(true);
   try {
     return cipherConstructor.newInstance(cipherSpi, transformation);
   } catch (final InvocationTargetException e) {
     throw e.getCause();
   }
 }