Avoid using the deprecated java.security.cert APIs

The following APIs have been deprecated in Java SE 16:

Remove the usage of these methods in your application as they are unsafe to use and will be removed in a future release.

For more information on the deprecation of these methods, see Deprecate "denigrated" java.security.cert APIs that represent DNs as Principal or String objects.