title: Maven password encryption BadPaddingException
body: <p>I'm trying to encrypt a server password in my settings.xml and I'm getting this exception when trying to deploy an artifact.</p>
  
  <pre><code>Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
      at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:811)
      at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:676)
      at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:313)
      at javax.crypto.Cipher.doFinal(Cipher.java:2087)
      at org.sonatype.plexus.components.cipher.PBECipher.decrypt64(PBECipher.java:185)
      ... 18 more
  </code></pre>
  
  <p>here's the excerpt from the xml</p>
  
  <pre><code>&lt;server&gt;
              &lt;id&gt;server&lt;/id&gt;
              &lt;username&gt;username&lt;/username&gt;
              &lt;password&gt;{N8AF8BmQ5x8HZX/yrlrP1QiKNMEdoXWyBFZd/*zIabY=}&lt;/password&gt; 
          &lt;/server&gt;
  </code></pre>
  
  <p>the same exception is also happening for my master password, I just followed the instructions here
  <a href="https://maven.apache.org/guides/mini/guide-encryption.html">https://maven.apache.org/guides/mini/guide-encryption.html</a>
  created a security-settings.xml like in the guide, executed these two commands and copied the encrypted passwords into the appropriate xml files.</p>
  
  <pre><code>mvn --encrypt-master-password &lt;password&gt;
  mvn --encrypt-password &lt;password&gt;
  </code></pre>