0

I am in a big problem . I have to call EJBCA web services in a python client in order to post a certificate . I wrote my code as follow :

            session = Session()
            session.verify = False
            session.cert = cert_pair_verify

            client = Client(
                'url/ejbca/ejbcaws/ejbcaws?wsdl',
                wsse=BinarySignatureTimestamp(
                    client_key_path,
                    client_cert_path,
                ), 
                transport=Transport(session=session))

userDataVOWS = client.get_type(
            '{http://ws.protocol.core.ejbca.org/}userDataVOWS')

        user = userDataVOWS()

        user.caName = 'CA'
        user.username = 'test'
        user.password = 'Tests'
        user.clearPwd = False
        user.subjectDN = 'test'

        user.tokenType = "USERGENERATED"
        user.keyRecoverable = False
        user.sendNotification = False
        user.status = 10
        user.endEntityProfileName = "EMPTY"
        user.certificateProfileName = "ENDUSER"
        
        response = client.service.certificateRequest(None,csr,0,None,"CERTIFICATE")
        # print('this is a test of response %s' %response)
        return zeep.helpers.serialize_object(response)

This is the entred csr :

-----BEGIN CERTIFICATE REQUEST-----
MIICjTCCAXUCAQAwFzEVMBMGA1UEAwwMZGlnaXRhbGJlcnJ5MIIBIjANBgkqhkiG
9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxhMKaghHJcYrqlzEn38d76CELX7EimmbdRvR
PGv0f/iC+DmxDN8ODkd7dOWlxmSWOJzGXlkI/TPL4RfHteyHGU9KFtWZMCGU1LGE
BjYVPDDxeIkYDySW5MnKo7pdA647LlFPZdQpFaKM52zcb1+Ft+li8KVfTBqg5RHl
RauXG/Uk+8XamoSBZ90C+HibAJgI9OY7eDQM2haOiufijYvwDFyzOUpFfsUVUZJu
jaeLOqWvTTmccAPuKP6aJNAe40896qzpWwfET2NP/AjBzbQsbo/GFBIIE+hKImhC
ZtfGfNdSgkUKw6WvSMsVWe9PQ3+JmHlGAiIs237az39/L+o83QIDAQABoDEwLwYJ
KoZIhvcNAQkOMSIwIDAeBgNVHREEFzAVghN3d3cuZGlnaXRhbGJlcnJ5LmZyMA0G
CSqGSIb3DQEBCwUAA4IBAQBvJpWBsdlJYqZaPFXlopOJCm4Qwyc7FO+uDBrUbYPY
dzvCRTTwitwLRLT6NCHof5yj5lNnSUYGfTqSfyvsfbPGIh9cdv6XQjmvEVn20/cb
Fqw+KnZoLRzQxGbyS+MhJ8lwmN3TMgvdU/RPqvjRWOhApz3L7HiNpoEuuxYfB1Jw
I64T3mELXVRWITHswupbbyQOvA0eZLOm5Wl4xZZ29tbUucgZCpYO2+RRyssucyXi
0LbVCaBlutpne292dgE36BoOl/x9mGGU+G7eaidL9rThdeDzVpGR7J80l4vJ6rMo
wS5UDZfSmsgsPCuaUNIyPMDyxRLUIP7zKq/9faObHUY3
-----END CERTIFICATE REQUEST----- -

I don't know what mistake i made , but I get an index out of bound exception on the client.service method . Who have an idea how to solve this problem please ? Thank you .

Hana_CH
  • 105
  • 1
  • 12

1 Answers1

0

The CSR you pasted above have an extra " -" in the end of the ending PEM row.

primetomas
  • 524
  • 2
  • 5
  • It was added by mistake while pasting it here ... But I don't really know what could be the problem that causes that – Hana_CH May 28 '21 at 10:17
  • If you enable WS transaction logging you can run the command using the clientToolBox tool (working) and then compare the actual SOAP messages with the one from your client. That should make it easy to figure out the exact parameters issues.https://doc.primekey.com/ejbca/ejbca-operations/ejbca-ca-concept-guide/protocols/web-service-interface#WebServiceInterface-WSTransactionLoggingWS_transaction_logging – primetomas May 31 '21 at 10:02