Uploaded image for project: 'EJBCA'
  1. EJBCA
  2. ECA-4303

NPE thrown when hard token password is not provided to ca importca command

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Not needed to fix
    • Affects Version/s: EJBCA 6.2.7
    • Fix Version/s: None
    • Component/s: CLI
    • Issue discovered during:
      Integration

      Description

      When running the ca importca CLI command, in case the hard token password is not provided, an NPE will be thrown, and a stack trace will be shown to the user.

      The JBoss log will contain an error message:

      ---%---
      10:35:36,000 ERROR [org.jboss.as.ejb3.invocation] (EJB default - 8) JBAS014134: EJB Invocation failed on component CAAdminSessionBean for method public abstract void org.ejbca.core.ejb.ca.caadmin.CAAdminSession.importCAFromHSM(org.cesecore.authentication.tokens.AuthenticationToken,java.lang.String,java.security.cert.Certificate[],java.lang.String,java.lang.String,java.lang.String) throws org.cesecore.keys.token.CryptoTokenOfflineException,org.cesecore.keys.token.CryptoTokenAuthenticationFailedException,org.cesecore.keys.token.IllegalCryptoTokenException,org.cesecore.certificates.ca.CAExistsException,org.cesecore.authorization.AuthorizationDeniedException,org.cesecore.certificates.ca.CAOfflineException,org.cesecore.keys.token.p11.exception.NoSuchSlotException: javax.ejb.EJBException: java.lang.NullPointerException
      ---%---

      It would be better if the check was made while parsing for commands and warning the users that password must be provided as well.

      Command that throws NPE:

      bin/ejbca.sh ca importca --caname UtopiaRootCA --cert ~/import/UtopiaRootCA.pem --hard --cp org.cesecore.keys.token.PKCS11CryptoToken --prop ~/import/catoken.properties

      Command that works:

      bin/ejbca.sh ca importca --caname UtopiaRootCA --cert ~/import/UtopiaRootCA.pem --hard --cp org.cesecore.keys.token.PKCS11CryptoToken --prop ~/import/catoken.properties --ctpassword 1234

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            branko Branko Majic (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: