Unable to authenticate server certificate due to trailing spaces

792 Views Asked by At

I've created a java spring-boot application that communicates with a server and sends it requests periodically. For security reasons i need to validate the certificates of the server, however there is a strange issue with the server's certificate.

The name of the server in the list of Subject Alternative Names (SAN) contains a trailing space character. So the name of the server does not match any of the names in the certificate according to the code...

For example if the URI is "https://server-01.org/" then the SAN of that server in the certificate is "server-01.org " which is a slight mismatch...

Is there a way in java to ignore the trailing spaces in the certificate? I'm unable to change the server certificates, also other systems do not seem to trip over this issue. Is there a setting i can use in the java code?

0

There are 0 best solutions below