Skip to content

Is there a way to get an exception of the certificate expired/revoked from AWSIotMqttManager in kotlin android?

0

We need a sample to get an exception of certificate expired/revoked from AWSIotMqttManager in Android, to check what exception message it is throwing when certificate expired/revoked

We need exact exception message when certificate expired/revoked in AWSIotMqttManager.

1 Answer
0

Hi team,

Unfortunately, AWSIotMqttManager itself doesn't provide a specific exception for certificate expiration or revocation. However, you can deduce it from the exceptions thrown during connection attempts: 1. states that AWS IoT denies connections with expired or revoked certificates. When a connection fails due to a certificate issue, AWSIotMqttManager throws a generic AmazonClientException 2. To identify if the cause is an expired or revoked certificate, you need to analyze the exception chain for an SSLHandshakeException. This exception usually signals a problem with the certificate, such as expiration or revocation1.

Here's how you can approach this:

Implement an MqttStatusCallback to monitor the connection status. When onStatusChanged is invoked with a status other than AWSIotMqttClientStatusCallback.Connected, check if the throwable parameter is an instance of AmazonClientException. If it is, traverse the exception chain by examining the cause of each exception until you find an SSLHandshakeException. This indicates a potential certificate issue.

Remember that this approach relies on inferring the certificate problem from the exception chain. AWSIotMqttManager doesn't explicitly provide distinct exceptions for certificate expiration and revocation.

AWS

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.