Menu

Programmatically fetching certificates

Jesus
2010-07-05
2013-02-18
  • Jesus

    Jesus - 2010-07-05

    Hello,

    I am interested in automatically generating certificates for some users (given that I've somehow verified their identity previously, e.g., they are using a "disposable" link I've given to them - in a secure way -, for that purpose). I found the HttpGetCert.java sample program, which, in it's comment, says: "Example how a certificate can be fetched programmatically using HTTP/S".

    That was exactly what I wanted, so I've adapted it to work as a Servlet attending certificate requests (via a a proxy which validates them previously). But now, I'm testing it and I get the following error:

    javax.servlet.ServletException: java.io.FileNotFoundException: http://mysite.com:8080/ejbca/publicweb/apply/certreq
    at ServletFetchCertificate.doPost(ServletFetchCertificate.java:316)

    I'm using the URL mysite.com/ejbca/publicweb/apply/certreq because it's the URL specified within the sample code, and I thought it was a standard URL used for that purpose, but now I'm getting this error, I've looked for any reference to it and I haven't found anything.

    Does anyone know what is the way in which it must be done? I'd appreciate any help on the matter.

    Thank you.

    PS: I'm using EJBCA 3.10.1 with JBOSS 4.2.3-GA

     
  • Tomas Gustavsson

    The sample is rather old and the url is just outdated.
    http://localhost:8080/ejbca/certreq

    You can check how the public web pages work, they use the same servlet.

    Cheers,
    Tomas


    PrimeKey Solutions offers commercial EJBCA and SignServer support subscriptions and training courses. Please see www.primekey.se or contact info@primekey.se for more information. 
    http://www.primekey.se/Services/Support/
    http://www.primekey.se/Services/Training/

     
  • Jesus

    Jesus - 2010-07-06

    Ok. Thank you very much. It worked!

    But now I have a doubt that I should have considered before. If I want to create new users, also programmatically, to be able to fetch certificates to them, the right way will be using the org.ejbca.core.ejb.ra.LocalUserAdminSessionBean addUser(..UserDataVO..) method? This is the method that seems to be the most appropiate that I've found, but I'll thank an expert confirmation (or correction, if proceeds).

    Thank you again.

     
  • Tomas Gustavsson

    You are right again. The best example for using the ejb API should be the command line interface in modules/ejbca-ejb-cli.

    Cheers,
    Tomas

     

Log in to post a comment.