title: Generate a signed apk - Get Key failed: Given final block not properly padded
body: <p>I'm trying to publish my first app on Google Play and I encounter difficulties. 
  Let me explain my problem to you:
  My app compiles and I want to generate a signed apk...
  That doesn't work with android studio <code>(Build--&gt; generate signed budle/apk)</code> and I had the next error message:</p>
  
  <pre><code>erreur keytool : java.io.FileNotFoundException: C:\Users\sebla\Desktop\AndroidApp\jdk-11.0.1\bin\mykeystore.jks (Accès refusé)
  </code></pre>
  
  <p>Then, I succeeded in creating the keystore (via cmd):<br>
  <code>C:\Users\sebla\Desktop\AndroidApp\jdk-11.0.1\bin&gt;keytool -genkey -v -keystore appkeystore.keystore -alias permisKey -keyalg RSA -keysize 2048 -validity 10000</code>  </p>
  
  <p>but now I got the following error message when generating the signed apk:</p>
  
  <pre><code>Something went wrong with the encryption tool: Get Key failed: Given final block not properly padded
  java.security.UnrecoverableKeyException: Get Key failed: Given final block not properly padded
      at sun.security.pkcs12.PKCS12KeyStore.engineGetKey(PKCS12KeyStore.java:410)
      at sun.security.provider.KeyStoreDelegator.engineGetKey(KeyStoreDelegator.java:96)
      at sun.security.provider.JavaKeyStore$DualFormatJKS.engineGetKey(JavaKeyStore.java:70)
      at java.security.KeyStore.getKey(KeyStore.java:1023)
      at com.google.wireless.android.vending.developer.signing.tools.extern.export.KeystoreHelper.extractPrivateKey(KeystoreHelper.java:56)
      at com.google.wireless.android.vending.developer.signing.tools.extern.export.KeystoreHelper.getPrivateKey(KeystoreHelper.java:35)
      at com.google.wireless.android.vending.developer.signing.tools.extern.export.ExportEncryptedPrivateKeyTool.run(ExportEncryptedPrivateKeyTool.java:98)
      at org.jetbrains.android.exportSignedPackage.ExportSignedPackageWizard$2.run(ExportSignedPackageWizard.java:241)
      at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:750)
      at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
      at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580)
      at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
      at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
      at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
      at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:395)
      at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:305)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
      at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:989)
      at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:845)
      at com.sun.crypto.provider.PKCS12PBECipherCore.implDoFinal(PKCS12PBECipherCore.java:399)
      at com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndDESede.engineDoFinal(PKCS12PBECipherCore.java:431)
      at javax.crypto.Cipher.doFinal(Cipher.java:2165)
      at sun.security.pkcs12.PKCS12KeyStore.engineGetKey(PKCS12KeyStore.java:348)
      ... 20 more
  ------------------------------------
  </code></pre>
  
  <p>Some help would be much appreciated as I'm completely lost and frustrated not being able to publish my app.
  Do I have any code to implement in manifest or gradle to remove that error?</p>