lwm2m - trust certificate, fix bug X509_TrustLwM2MIntegrationTest

This commit is contained in:
nickAS21 2021-11-25 18:05:23 +02:00
parent 0c499014d4
commit a12771ecfb
2 changed files with 2 additions and 2 deletions

View File

@ -161,7 +161,7 @@ public abstract class AbstractSecurityLwM2MIntegrationTest extends AbstractLwM2M
rootCAX509Cert = (X509Certificate) serverKeyStore.getCertificate("rootCA"); rootCAX509Cert = (X509Certificate) serverKeyStore.getCertificate("rootCA");
serverX509Cert = (X509Certificate) serverKeyStore.getCertificate("server"); serverX509Cert = (X509Certificate) serverKeyStore.getCertificate("server");
serverX509CertSelfSigned = (X509Certificate) serverKeyStore.getCertificate("server_self_signed"); serverX509CertSelfSigned = (X509Certificate) serverKeyStore.getCertificate("server_self_signed");
trustedCertificates[0] = rootCAX509Cert; trustedCertificates[0] = serverX509Cert;
} catch (GeneralSecurityException | IOException e) { } catch (GeneralSecurityException | IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@ -144,7 +144,7 @@ public class TbLwM2MDtlsCertificateVerifier implements NewAdvancedCertificateVer
X509ClientCredential config = (X509ClientCredential) credentials.getClient(); X509ClientCredential config = (X509ClientCredential) credentials.getClient();
String certBody = config.getCert(); String certBody = config.getCert();
String endpoint = config.getEndpoint(); String endpoint = config.getEndpoint();
if (certBody.isEmpty() || strCert.equals(certBody)) { if (StringUtils.isBlank(certBody) || strCert.equals(certBody)) {
x509CredentialsFound = true; x509CredentialsFound = true;
DeviceProfile deviceProfile = msg.getDeviceProfile(); DeviceProfile deviceProfile = msg.getDeviceProfile();
if (msg.hasDeviceInfo() && deviceProfile != null) { if (msg.hasDeviceInfo() && deviceProfile != null) {