By: David Harris user 18 Dec 2019 at 12:05 p.m. CST

2 Responses
David Harris gravatar
Hi, I have Gluu 4.0 installed and I’m trying to get Certificate authentication working. I’ve followed the instructions here: and set up my Default oxTrust authentication mode to be ‘Cert’. Next I try to access a site that is using the gluu server for authentication via SAML. I get redirected to the ‘auth/cert/login.htm’ page which asks me to click the login button and then choose my cert. I do so and I am presented with the dialog box asking me to choose a cert and all the certs I expect to see are there. After choosing a certificate I get an error screen. I see that the script seems to be throwing an error when attempting to process the cert: ``` Traceback (most recent call last): File "", line 241, in prepareForStep File "", line 370, in certFromPemString File "", line 366, in certFromString AttributeError: type object 'org.gluu.oxauth.util.CertUtil' has no attribute 'x509CertificateFromBytes' at org.python.core.Py.AttributeError( at org.python.core.PyType.noAttributeError( at org.python.core.PyObject.__getattr__( at org.python.pycode._pyx1.certFromString$19( at org.python.pycode._pyx1.call_function( at at ``` … I’m not sure if I did something wrong during the set up or how I should correct this error, does anyone have any idea? Thanks David

By David Harris user 20 Dec 2019 at 9:11 p.m. CST

David Harris gravatar
The x509CertificateFromBytes method was removed from the CertUtil class in commit ‘aacbf5de51a9d510b12125010231c930a2732c9c’ (back when it was in the org.xdi.oxauth.util and not the org.gluu.oxauth.util package). The python script ‘’ was still referencing the x509CertificateFromBytes method and that is what was causing the error. I was able to get it working again by changing the script using in the following ways: First I added these imports: ``` from import CertificateFactory from import ByteArrayInputStream ``` Then I changed: ``` def certFromString(self, x509CertificateEncoded): x509CertificateDecoded = base64.b64decode(x509CertificateEncoded) return CertUtil.x509CertificateFromBytes(x509CertificateDecoded) ``` To: ``` def certFromString(self, x509CertificateEncoded): x509CertificateDecoded = base64.b64decode(x509CertificateEncoded) certFactory = CertificateFactory.getInstance("X.509"); return certFactory.generateCertificate(ByteArrayInputStream(x509CertificateDecoded)); ``` I’m not sure if that is the best way or not but it works and only required a change to the .py script. David

By Yuriy Movchan staff 21 Dec 2019 at 2:39 a.m. CST

Yuriy Movchan gravatar
Hi, You are tight. We moved this method to `from org.gluu.oxauth.model.util import CertUtils` during work on MLTS update. Thank you for informing us about this wrong import!