I am trying to export one of the aliases from the pkcs12 keystore to a new "empty" keystore of the same type (i.e. pkcs12).
keytool -importkeystore -v -srckeystore vault.p12 -destkeystore p2.p12 -srcstoretype PKCS12 -deststoretype PKCS12 -srcstorepass yyyy -deststorepass xxxx -srcalias p2 -destalias p2
This command gives an empty p2.p12 file and a failure:
[Storing p986wasuser.p12] keytool error (likely untranslated): java.io.IOException: Error in storing the key store: Given final block not properly padded
As I managed to find out this was a working way to solve my problem: