Lwm2m: front - fix bug /../../
This commit is contained in:
parent
cb3353a32d
commit
84698ad554
@ -245,8 +245,7 @@ public class LwM2MTransportBootstrapServerConfiguration {
|
||||
}
|
||||
if (serverCertificate != null) {
|
||||
builder.setCertificateChain(new X509Certificate[]{serverCertificate});
|
||||
this.contextBs.getCtxBootStrap().setBootstrapCertificate(serverCertificate);
|
||||
infoParamsX509(serverCertificate);
|
||||
this.infoParamsX509(serverCertificate);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.error("[{}] Unable to load KeyStore files server", ex.getMessage());
|
||||
|
||||
@ -52,6 +52,7 @@ import java.security.KeyFactory;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PublicKey;
|
||||
import java.security.cert.CertificateEncodingException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.security.interfaces.ECPublicKey;
|
||||
import java.security.spec.ECGenParameterSpec;
|
||||
@ -306,8 +307,36 @@ public class LwM2MTransportServerConfiguration {
|
||||
PrivateKey privateKey = (PrivateKey) this.context.getCtxServer().getKeyStoreValue().getKey(this.context.getCtxServer().getServerAlias(), this.context.getCtxServer().getKeyStorePasswordServer() == null ? null : this.context.getCtxServer().getKeyStorePasswordServer().toCharArray());
|
||||
builder.setPrivateKey(privateKey);
|
||||
builder.setCertificateChain(new X509Certificate[]{serverCertificate});
|
||||
this.infoParamsX509(serverCertificate, privateKey);
|
||||
} catch (Exception ex) {
|
||||
log.error("[{}] Unable to load KeyStore files server", ex.getMessage());
|
||||
}
|
||||
// /**
|
||||
// * For deb => KeyStorePathFile == yml or commandline: KEY_STORE_PATH_FILE
|
||||
// * For idea => KeyStorePathResource == common/transport/lwm2m/src/main/resources/credentials: in LwM2MTransportContextServer: credentials/serverKeyStore.jks
|
||||
// */
|
||||
// try {
|
||||
// X509Certificate serverCertificate = (X509Certificate) this.context.getCtxServer().getKeyStoreValue().getCertificate(this.context.getCtxServer().getServerPrivateS());
|
||||
// this.privateKey = (PrivateKey) this.context.getCtxServer().getKeyStoreValue().getKey(this.context.getCtxServer().getServerAlias(), this.context.getCtxServer().getKeyStorePasswordServer() == null ? null : this.context.getCtxServer().getKeyStorePasswordServer().toCharArray());
|
||||
// if (this.privateKey != null && this.privateKey.getEncoded().length > 0) {
|
||||
// builder.setPrivateKey(this.privateKey);
|
||||
// }
|
||||
// if (serverCertificate != null) {
|
||||
// builder.setCertificateChain(new X509Certificate[]{serverCertificate});
|
||||
// this.infoParamsX509(serverCertificate);
|
||||
// }
|
||||
// } catch (Exception ex) {
|
||||
// log.error("[{}] Unable to load KeyStore files server", ex.getMessage());
|
||||
// }
|
||||
}
|
||||
|
||||
private void infoParamsX509(X509Certificate certificate, PrivateKey privateKey) {
|
||||
try {
|
||||
log.info("Server uses X509 : \n X509 Certificate (Hex): [{}] \n Private Key (Hex): [{}]",
|
||||
Hex.encodeHexString(certificate.getEncoded()),
|
||||
Hex.encodeHexString(privateKey.getEncoded()));
|
||||
} catch (CertificateEncodingException e) {
|
||||
log.error("", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@ -16,6 +16,9 @@
|
||||
#
|
||||
|
||||
# source the properties:
|
||||
script_dir=$(dirname $0)
|
||||
echo "script_dir: $script_dir"
|
||||
cd $script_dir
|
||||
. ./lwM2M_keygen.properties
|
||||
|
||||
# Generation of the keystore.
|
||||
|
||||
@ -43,7 +43,7 @@ CLIENT_STORE=clientKeyStore.jks
|
||||
CLIENT_STORE_PWD=client_ks_password
|
||||
CLIENT_ALIAS=client
|
||||
#CLIENT_CN=client_lwm2m_x509
|
||||
CLIENT_CN=mobile_lwm2m_x509
|
||||
CLIENT_CN=LwX50900000000
|
||||
CLIENT_SELF_ALIAS=client_self_signed
|
||||
CLIENT_SELF_CN="$DOMAIN_SUFFIX client LwM2M self-signed"
|
||||
|
||||
|
||||
@ -24,7 +24,6 @@ import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.gen.transport.TransportProtos;
|
||||
|
||||
import java.security.PublicKey;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@ -104,10 +103,6 @@ public class LwM2MTransportConfigBootstrap {
|
||||
@Value("${transport.lwm2m.bootstrap.secure.alias:}")
|
||||
private String bootstrapAlias;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private X509Certificate bootstrapCertificate;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private Map<String /** clientEndPoint */, TransportProtos.ValidateDeviceCredentialsResponseMsg> sessions;
|
||||
|
||||
@ -233,7 +233,7 @@ public class LwM2MTransportConfigServer {
|
||||
} else {
|
||||
log.error(" [{}] Read Models", path.getAbsoluteFile());
|
||||
}
|
||||
getInKeyStore();
|
||||
this.getInKeyStore();
|
||||
}
|
||||
|
||||
private File getPathModels() {
|
||||
|
||||
Binary file not shown.
@ -36,7 +36,7 @@ import {
|
||||
import { Store } from "@ngrx/store";
|
||||
import { AppState } from "@core/core.state";
|
||||
import { coerceBooleanProperty } from "@angular/cdk/coercion";
|
||||
import { WINDOW } from "../../../../../../core/services/window.service";
|
||||
import { WINDOW } from "@core/services/window.service";
|
||||
import { pairwise, startWith } from 'rxjs/operators';
|
||||
import { DeviceProfileService } from '@core/http/device-profile.service';
|
||||
|
||||
|
||||
@ -35,9 +35,9 @@ import {
|
||||
TELEMETRY,
|
||||
ObjectLwM2M, getDefaultProfileConfig, KEY_NAME, Instance
|
||||
} from "./profile-config.models";
|
||||
import { DeviceProfileService } from "../../../../../../core/http/device-profile.service";
|
||||
import { deepClone, isUndefined } from "../../../../../../core/utils";
|
||||
import { WINDOW } from "../../../../../../core/services/window.service";
|
||||
import { DeviceProfileService } from "@core/http/device-profile.service";
|
||||
import { deepClone, isUndefined } from "@core/utils";
|
||||
import { WINDOW } from "@core/services/window.service";
|
||||
import { JsonObject } from '@angular/compiler-cli/ngcc/src/packages/entry_point';
|
||||
import { isNotNullOrUndefined } from 'codelyzer/util/isNotNullOrUndefined';
|
||||
|
||||
|
||||
@ -30,14 +30,14 @@ import {
|
||||
} from "@angular/forms";
|
||||
import { coerceBooleanProperty } from "@angular/cdk/coercion";
|
||||
import { Store } from "@ngrx/store";
|
||||
import { AppState } from "../../../../../../core/core.state";
|
||||
import { AppState } from "@core/core.state";
|
||||
import { MatChipList } from '@angular/material/chips';
|
||||
import {
|
||||
INSTANCES_ID_VALUE_MAX,
|
||||
INSTANCES_ID_VALUE_MIN
|
||||
} from "./profile-config.models";
|
||||
import { TranslateService } from "@ngx-translate/core";
|
||||
import { DeviceProfileService } from "../../../../../../core/http/device-profile.service";
|
||||
import { DeviceProfileService } from "@core/http/device-profile.service";
|
||||
|
||||
@Component({
|
||||
selector: 'tb-profile-lwm2m-object-add-instances-list',
|
||||
|
||||
@ -32,16 +32,16 @@ import {
|
||||
} from "@angular/forms";
|
||||
import {coerceBooleanProperty} from "@angular/cdk/coercion";
|
||||
import {Store} from "@ngrx/store";
|
||||
import {AppState} from "../../../../../../core/core.state";
|
||||
import {AppState} from "@core/core.state";
|
||||
import {MatChipList} from '@angular/material/chips';
|
||||
import {MatAutocomplete} from "@angular/material/autocomplete";
|
||||
import {Observable} from "rxjs";
|
||||
import {filter, map, mergeMap, share, tap} from 'rxjs/operators';
|
||||
import {ObjectLwM2M} from "./profile-config.models";
|
||||
import {TranslateService} from "@ngx-translate/core";
|
||||
import {DeviceProfileService} from "../../../../../../core/http/device-profile.service";
|
||||
import {PageLink} from "../../../../../../shared/models/page/page-link";
|
||||
import {Direction} from "../../../../../../shared/models/page/sort-order";
|
||||
import {DeviceProfileService} from "@core/http/device-profile.service";
|
||||
import {PageLink} from "@shared/models/page/page-link";
|
||||
import {Direction} from "@shared/models/page/sort-order";
|
||||
|
||||
@Component({
|
||||
selector: 'tb-profile-lwm2m-object-list',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user