Menu

methods missing

alis
2014-12-21
2014-12-23
  • alis

    alis - 2014-12-21

    i am writing this code :
    Example generating a certificate from a PKCS10 request:

    UserDataVOWS user1 = new UserDataVOWS();
    user1.setUsername("WSTESTUSER1");

    KeyPair keys = KeyTools.genKeys("1024", AlgorithmConstants.KEYALGORITHM_RSA);
    PKCS10CertificationRequest pkcs10 = new PKCS10CertificationRequest("SHA256WithRSA",
    CertTools.stringToBcX500Name("CN=NOUSED"), keys.getPublic(), null, keys.getPrivate());
    CertificateResponse certenv = ejbcaraws.certificateRequest(user1,
    CertificateHelper.CERT_REQ_TYPE_PKCS10,
    new String(Base64.encode(pkcs10.getEncoded())),
    null,
    CertificateHelper.RESPONSETYPE_CERTIFICATE);
    X509Certificate cert = certenv.getCertificate ();
    the getCertificate() methods gives error why is it and what is solution?

     
  • Mike Kushner

    Mike Kushner - 2014-12-21

    And what error do you get?

    Cheers,
    Mike Kushner
    Release Manager, Primekey Solutions


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


     
  • alis

    alis - 2014-12-21

    i can't invoke the getCertificate() method.method not available ...

     
  • Tomas Gustavsson

    In the code you pasted there is space character too much.

     
  • alis

    alis - 2014-12-21

    the pasted piece of code is present in this site :
    http://www.ejbca.org/docs/adminguide.html#EJBCA Web Service Interface
    the sample code; is there any conflict of jars or version of java ?

     
  • alis

    alis - 2014-12-22

    this is the shortest code i have :
    org.ejbca.core.protocol.ws.objects.CertificateResponse certenv=port.certificateRequest(userData, new String(Base64.encode(pkcs10.getEncoded())), CertificateHelper.CERT_REQ_TYPE_PKCS10, null, CertificateHelper.RESPONSETYPE_CERTIFICATE);
    X509Certificate cert = certenv.getCertificate();
    it gies this error :"incompatible types: org.ejbca.core.protocol.ws.CertificateResponse cannot be converted to org.ejbca.core.protocol.ws.objects.CertificateResponse"

    Alternately when i use the below code:
    org.ejbca.core.protocol.ws.CertificateResponse certenv=port.certificateRequest(userData,new String(Base64.encode(pkcs10.getEncoded())), CertificateHelper.CERT_REQ_TYPE_PKCS10, null,CertificateHelper.RESPONSETYPE_CERTIFICATE);
    X509Certificate cert = certenv.getCertificate();
    it gives this error:"cannot find symbolsymbol: method getCertificate()"
    please suggest a solution. thank you

     
  • Mike Kushner

    Mike Kushner - 2014-12-22

    Okay, you seem to be mixing wildly versions of EJBCA and I'm not sure what else. org.ejbca.core.protocol.ws.CertificateResponse doesn't exist and from what I can tell, hasn't in any recent memory. Is it something homegrown you're trying to use, or a branch?

    org.ejbca.core.protocol.ws.objects.CertificateResponse got the getCertificate() method back in version 3.10, so the server you're receiving the response from is obviously older than that version. Either upgrade the server to something more recent or scale your client back to using EJBCA 3.9 code.

    Ps. You're probably better off in the future if you learn the difference between two classes of the same name in different packages.

    Cheers,
    Mike Kushner
    Release Manager, Primekey Solutions


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


     
  • alis

    alis - 2014-12-22

    thank you sir !,
    i am using EJBCA 4.X and
    org.ejbca.core.protocol.ws.objects is package generated by the webservice mechanism in Netbeans IDE.
    CertificateResponse class in present in both the above mentioned package and in the jar "ejbca-ws-cli.jar" downloaded from EJBCA server under package " org.ejbca.core.protocol.ws.client.gen" . do i need to use ejbca-ws-cli.jar or ejbca-ws.jar is enough.i don't exactly understand y this error arises even i manually checked that the getCertificate method is presend in this class.
    i pasted a pictorial view of the problem ,please have a loo at the image below :thank you .

     

    Last edit: alis 2014-12-22
  • Mike Kushner

    Mike Kushner - 2014-12-22

    The WS CLI package is only relevant if you're using a Command Line Interface, which you're not, so you can safely ignore it.

    As I said, the version of CertificateResponse you're getting from the server is back from version 3.9, and doesn't contain the method you're looking for. That's it. Either upgrade the server to a newer version of EJBCA or forget about the getCertificate() method in your client.

    Cheers,
    Mike

     
  • alis

    alis - 2014-12-22

    thank you sir , i would upgrade server to test.

     
  • alis

    alis - 2014-12-23

    Hello sir !
    i have upgraded my server version to ejbca_ce_6_1_1 but still i cannot invoke getCertificate() using the object of CertificateResponse class.
    why it doesn't shows the getCertificate() method??

     
  • alis

    alis - 2014-12-23

    if the method is missing then how can i generate a certificate request and get a certificate from the response? in case of missing getCertificate() Method?

     
  • Tomas Gustavsson

    I don't know, From looking at the source code, all varians of CertificateResponse java class has getCertificate() method available.

    Do you have the correct classes imported?

    Cheers,
    Tomas

     
  • alis

    alis - 2014-12-23

    i have this CertificateResponse class in proxy/stub(generated from wsdl) classes and also in the jar(ejbca-ws.jar) under package org.ejbca.core.protocol.ws.object; i took from server.i used both of them but the methods still missing i don't know why ?

     

Log in to post a comment.