Skip to content
Advertisement

KeyUsage does not allow digital signatures

I’m trying to send HTTPS request from my Java EE program to the host that requires certificate authentication. I have a proper keystore file, truststore with imported CA, the listing of both shows that certificates are inside.

But I receive the following error:

JavaScript

Viewing the certificate contents in the part of Extensions I see the following:

JavaScript

So my certificate does contain KeyUsage [ DigitalSignature ]

The code snippet of the place throwing the exception looks like the following:

JavaScript

and checkKeyUsage function:

JavaScript

it fails in return (keyUsage.length > bit) && keyUsage[bit];

The question is why the result of above expression = false? When bit = 0 and cert.getKeyUsage() must return an array of boolean [true, false, false, false, false, false, false, false, false]

Advertisement

Answer

The error actually comes from verifying the server’s certificate. That certificate has a key usage section that doesn’t include a digitalSignature bit.

Some cipher suites require the digital signature bit, specifically Diffie-Hellman key exchange (DHE_RSA and ECDHE_RSA). You may be able to avoid this error by avoiding those cipher types. Otherwise the server certificate needs to support it.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement