Maven Password Encryption BadPaddingException

I try to encrypt the server password in my settings.xml, and I get this exception when trying to deploy an artifact.

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 

here is an excerpt from xml

 <server> <id>server</id> <username>username</username> <password>{N8AF8BmQ5x8HZX/yrlrP1QiKNMEdoXWyBFZd/*zIabY=}</password> </server> 

the same exception also occurs for my main password, I just followed the instructions here https://maven.apache.org/guides/mini/guide-encryption.html created the security-settings.xml file, as in the manual, I executed these two commands and copied the encrypted passwords into the corresponding xml files.

 mvn --encrypt-master-password <password> mvn --encrypt-password <password> 
+7
maven encryption
source share
2 answers

In rare cases, a problem arises that probably occurs here. Consider recovering masterpassword (using -emp or --encrypt-master-password) and / or password (with -ep or --encrypt-password). Their values ​​will be different every time.

+3
source share

Or maybe you accidentally copied the wrong parameter:

 --encrypt-master-password 

and put the output in settings.xml instead:

 --encrypt-password 

which led me into trouble. (Password Expiration Rules)

+1
source share

All Articles