我遇到了一个大问题。我必须在 python 客户端中调用 EJBCA Web 服务才能发布证书。我写了我的代码如下:
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)
这是输入的 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----- -
我不知道我犯了什么错误,但是我在 client.service 方法上得到一个索引超出范围的异常。谁知道如何解决这个问题?谢谢你 。