|
|
|
@ -42,6 +42,7 @@ import org.thingsboard.server.common.transport.util.SslUtil; |
|
|
|
import org.thingsboard.server.queue.util.TbLwM2mTransportComponent; |
|
|
|
import org.thingsboard.server.transport.lwm2m.config.LwM2MTransportServerConfig; |
|
|
|
import org.thingsboard.server.transport.lwm2m.secure.credentials.LwM2MCredentials; |
|
|
|
import org.thingsboard.server.transport.lwm2m.server.client.LwM2MAuthException; |
|
|
|
import org.thingsboard.server.transport.lwm2m.server.store.TbLwM2MDtlsSessionStore; |
|
|
|
import org.thingsboard.server.transport.lwm2m.server.store.TbMainSecurityStore; |
|
|
|
|
|
|
|
@ -118,7 +119,12 @@ public class TbLwM2MDtlsCertificateVerifier implements NewAdvancedCertificateVer |
|
|
|
|
|
|
|
String strCert = SslUtil.getCertificateString(cert); |
|
|
|
String sha3Hash = EncryptionUtil.getSha3Hash(strCert); |
|
|
|
TbLwM2MSecurityInfo securityInfo = securityInfoValidator.getEndpointSecurityInfoByCredentialsId(sha3Hash, CLIENT); |
|
|
|
TbLwM2MSecurityInfo securityInfo; |
|
|
|
try { |
|
|
|
securityInfo = securityInfoValidator.getEndpointSecurityInfoByCredentialsId(sha3Hash, CLIENT); |
|
|
|
} catch (LwM2MAuthException e) { |
|
|
|
securityInfo = null; |
|
|
|
} |
|
|
|
ValidateDeviceCredentialsResponse msg = securityInfo != null ? securityInfo.getMsg() : null; |
|
|
|
if (msg != null && org.thingsboard.server.common.data.StringUtils.isNotEmpty(msg.getCredentials())) { |
|
|
|
LwM2MCredentials credentials = JacksonUtil.fromString(msg.getCredentials(), LwM2MCredentials.class); |
|
|
|
|