committed by
GitHub
91 changed files with 4780 additions and 4296 deletions
@ -1,205 +0,0 @@ |
|||||
/** |
|
||||
* Copyright © 2016-2020 The Thingsboard Authors |
|
||||
* |
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||
* you may not use this file except in compliance with the License. |
|
||||
* You may obtain a copy of the License at |
|
||||
* |
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||
* |
|
||||
* Unless required by applicable law or agreed to in writing, software |
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||
* See the License for the specific language governing permissions and |
|
||||
* limitations under the License. |
|
||||
*/ |
|
||||
package org.thingsboard.server.transport.lwm2m.bootstrap.secure; |
|
||||
|
|
||||
import lombok.Data; |
|
||||
import lombok.extern.slf4j.Slf4j; |
|
||||
import org.eclipse.leshan.core.util.Hex; |
|
||||
import org.eclipse.leshan.server.californium.bootstrap.LeshanBootstrapServerBuilder; |
|
||||
import org.eclipse.leshan.server.security.EditableSecurityStore; |
|
||||
import org.thingsboard.server.transport.lwm2m.bootstrap.LwM2MTransportContextBootstrap; |
|
||||
import org.thingsboard.server.transport.lwm2m.secure.LwM2MSecurityMode; |
|
||||
import org.thingsboard.server.transport.lwm2m.server.LwM2MTransportContextServer; |
|
||||
|
|
||||
import java.math.BigInteger; |
|
||||
import java.security.AlgorithmParameters; |
|
||||
import java.security.KeyStore; |
|
||||
import java.security.PublicKey; |
|
||||
import java.security.PrivateKey; |
|
||||
import java.security.KeyFactory; |
|
||||
import java.security.GeneralSecurityException; |
|
||||
import java.security.KeyStoreException; |
|
||||
import java.security.cert.X509Certificate; |
|
||||
import java.security.interfaces.ECPublicKey; |
|
||||
import java.security.spec.ECGenParameterSpec; |
|
||||
import java.security.spec.ECParameterSpec; |
|
||||
import java.security.spec.ECPublicKeySpec; |
|
||||
import java.security.spec.ECPoint; |
|
||||
import java.security.spec.KeySpec; |
|
||||
import java.security.spec.ECPrivateKeySpec; |
|
||||
import java.util.Arrays; |
|
||||
|
|
||||
import static org.thingsboard.server.transport.lwm2m.secure.LwM2MSecurityMode.NO_SEC; |
|
||||
import static org.thingsboard.server.transport.lwm2m.secure.LwM2MSecurityMode.X509; |
|
||||
|
|
||||
@Slf4j |
|
||||
@Data |
|
||||
public class LwM2MSetSecurityStoreBootstrap { |
|
||||
|
|
||||
private KeyStore keyStore; |
|
||||
private PublicKey publicKey; |
|
||||
private PrivateKey privateKey; |
|
||||
private LwM2MTransportContextBootstrap contextBs; |
|
||||
private LwM2MTransportContextServer contextS; |
|
||||
private LeshanBootstrapServerBuilder builder; |
|
||||
EditableSecurityStore securityStore; |
|
||||
|
|
||||
public LwM2MSetSecurityStoreBootstrap(LeshanBootstrapServerBuilder builder, LwM2MTransportContextBootstrap contextBs, LwM2MTransportContextServer contextS, LwM2MSecurityMode dtlsMode) { |
|
||||
this.builder = builder; |
|
||||
this.contextBs = contextBs; |
|
||||
this.contextS = contextS; |
|
||||
/** Set securityStore with new registrationStore */ |
|
||||
|
|
||||
switch (dtlsMode) { |
|
||||
/** Use No_Sec only */ |
|
||||
case NO_SEC: |
|
||||
setServerWithX509Cert(NO_SEC.code); |
|
||||
break; |
|
||||
/** Use PSK/RPK */ |
|
||||
case PSK: |
|
||||
case RPK: |
|
||||
setRPK(); |
|
||||
break; |
|
||||
case X509: |
|
||||
setServerWithX509Cert(X509.code); |
|
||||
break; |
|
||||
/** Use X509_EST only */ |
|
||||
case X509_EST: |
|
||||
// TODO support sentinel pool and make pool configurable
|
|
||||
break; |
|
||||
/** Use ather X509, PSK, No_Sec ?? */ |
|
||||
default: |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void setRPK() { |
|
||||
try { |
|
||||
/** Get Elliptic Curve Parameter spec for secp256r1 */ |
|
||||
AlgorithmParameters algoParameters = AlgorithmParameters.getInstance("EC"); |
|
||||
algoParameters.init(new ECGenParameterSpec("secp256r1")); |
|
||||
ECParameterSpec parameterSpec = algoParameters.getParameterSpec(ECParameterSpec.class); |
|
||||
if (this.contextBs.getCtxBootStrap().getBootstrapPublicX() != null && !this.contextBs.getCtxBootStrap().getBootstrapPublicX().isEmpty() && this.contextBs.getCtxBootStrap().getBootstrapPublicY() != null && !this.contextBs.getCtxBootStrap().getBootstrapPublicY().isEmpty()) { |
|
||||
/** Get point values */ |
|
||||
byte[] publicX = Hex.decodeHex(this.contextBs.getCtxBootStrap().getBootstrapPublicX().toCharArray()); |
|
||||
byte[] publicY = Hex.decodeHex(this.contextBs.getCtxBootStrap().getBootstrapPublicY().toCharArray()); |
|
||||
/** Create key specs */ |
|
||||
KeySpec publicKeySpec = new ECPublicKeySpec(new ECPoint(new BigInteger(publicX), new BigInteger(publicY)), |
|
||||
parameterSpec); |
|
||||
/** Get keys */ |
|
||||
this.publicKey = KeyFactory.getInstance("EC").generatePublic(publicKeySpec); |
|
||||
} |
|
||||
if (this.contextBs.getCtxBootStrap().getBootstrapPrivateS() != null && !this.contextBs.getCtxBootStrap().getBootstrapPrivateS().isEmpty()) { |
|
||||
/** Get point values */ |
|
||||
byte[] privateS = Hex.decodeHex(this.contextBs.getCtxBootStrap().getBootstrapPrivateS().toCharArray()); |
|
||||
/** Create key specs */ |
|
||||
KeySpec privateKeySpec = new ECPrivateKeySpec(new BigInteger(privateS), parameterSpec); |
|
||||
/** Get keys */ |
|
||||
this.privateKey = KeyFactory.getInstance("EC").generatePrivate(privateKeySpec); |
|
||||
} |
|
||||
if (this.publicKey != null && this.publicKey.getEncoded().length > 0 && |
|
||||
this.privateKey != null && this.privateKey.getEncoded().length > 0) { |
|
||||
this.builder.setPublicKey(this.publicKey); |
|
||||
this.builder.setPrivateKey(this.privateKey); |
|
||||
this.contextBs.getCtxBootStrap().setBootstrapPublicKey(this.publicKey); |
|
||||
getParamsRPK(); |
|
||||
} |
|
||||
} catch (GeneralSecurityException | IllegalArgumentException e) { |
|
||||
log.error("[{}] Failed generate Server PSK/RPK", e.getMessage()); |
|
||||
throw new RuntimeException(e); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void setServerWithX509Cert(int securityModeCode) { |
|
||||
try { |
|
||||
if (this.contextS.getCtxServer().getKeyStoreValue() != null) { |
|
||||
KeyStore keyStoreServer = this.contextS.getCtxServer().getKeyStoreValue(); |
|
||||
setBuilderX509(); |
|
||||
X509Certificate rootCAX509Cert = (X509Certificate) keyStoreServer.getCertificate(this.contextS.getCtxServer().getRootAlias()); |
|
||||
if (rootCAX509Cert != null && securityModeCode == X509.code) { |
|
||||
X509Certificate[] trustedCertificates = new X509Certificate[1]; |
|
||||
trustedCertificates[0] = rootCAX509Cert; |
|
||||
this.builder.setTrustedCertificates(trustedCertificates); |
|
||||
} else { |
|
||||
/** by default trust all */ |
|
||||
this.builder.setTrustedCertificates(new X509Certificate[0]); |
|
||||
} |
|
||||
} |
|
||||
else { |
|
||||
/** by default trust all */ |
|
||||
this.builder.setTrustedCertificates(new X509Certificate[0]); |
|
||||
log.error("Unable to load X509 files for BootStrapServer"); |
|
||||
} |
|
||||
} catch (KeyStoreException ex) { |
|
||||
log.error("[{}] Unable to load X509 files server", ex.getMessage()); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
private void setBuilderX509() { |
|
||||
/** |
|
||||
* 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.contextS.getCtxServer().getKeyStoreValue().getCertificate(this.contextBs.getCtxBootStrap().getBootstrapAlias()); |
|
||||
this.privateKey = (PrivateKey) this.contextS.getCtxServer().getKeyStoreValue().getKey(this.contextBs.getCtxBootStrap().getBootstrapAlias(), this.contextS.getCtxServer().getKeyStorePasswordServer() == null ? null : this.contextS.getCtxServer().getKeyStorePasswordServer().toCharArray()); |
|
||||
if (this.privateKey != null && this.privateKey.getEncoded().length > 0) { |
|
||||
this.builder.setPrivateKey(this.privateKey); |
|
||||
} |
|
||||
if (serverCertificate != null) { |
|
||||
this.builder.setCertificateChain(new X509Certificate[]{serverCertificate}); |
|
||||
this.contextBs.getCtxBootStrap().setBootstrapCertificate(serverCertificate); |
|
||||
} |
|
||||
} catch (Exception ex) { |
|
||||
log.error("[{}] Unable to load KeyStore files server", ex.getMessage()); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void getParamsRPK() { |
|
||||
if (this.publicKey instanceof ECPublicKey) { |
|
||||
/** Get x coordinate */ |
|
||||
byte[] x = ((ECPublicKey) this.publicKey).getW().getAffineX().toByteArray(); |
|
||||
if (x[0] == 0) |
|
||||
x = Arrays.copyOfRange(x, 1, x.length); |
|
||||
|
|
||||
/** Get Y coordinate */ |
|
||||
byte[] y = ((ECPublicKey) this.publicKey).getW().getAffineY().toByteArray(); |
|
||||
if (y[0] == 0) |
|
||||
y = Arrays.copyOfRange(y, 1, y.length); |
|
||||
|
|
||||
/** Get Curves params */ |
|
||||
String params = ((ECPublicKey) this.publicKey).getParams().toString(); |
|
||||
log.info( |
|
||||
" \nBootstrap uses RPK : \n Elliptic Curve parameters : [{}] \n Public x coord : [{}] \n Public y coord : [{}] \n Public Key (Hex): [{}] \n Private Key (Hex): [{}]", |
|
||||
params, Hex.encodeHexString(x), Hex.encodeHexString(y), |
|
||||
Hex.encodeHexString(this.publicKey.getEncoded()), |
|
||||
Hex.encodeHexString(this.privateKey.getEncoded())); |
|
||||
} else { |
|
||||
throw new IllegalStateException("Unsupported Public Key Format (only ECPublicKey supported)."); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
// private void getParamsX509() {
|
|
||||
// try {
|
|
||||
// log.info("BootStrap uses X509 : \n X509 Certificate (Hex): [{}] \n Private Key (Hex): [{}]",
|
|
||||
// Hex.encodeHexString(this.certificate.getEncoded()),
|
|
||||
// Hex.encodeHexString(this.privateKey.getEncoded()));
|
|
||||
// } catch (CertificateEncodingException e) {
|
|
||||
// e.printStackTrace();
|
|
||||
// }
|
|
||||
// }
|
|
||||
} |
|
||||
File diff suppressed because it is too large
@ -1,38 +0,0 @@ |
|||||
/** |
|
||||
* Copyright © 2016-2020 The Thingsboard Authors |
|
||||
* |
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||
* you may not use this file except in compliance with the License. |
|
||||
* You may obtain a copy of the License at |
|
||||
* |
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||
* |
|
||||
* Unless required by applicable law or agreed to in writing, software |
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||
* See the License for the specific language governing permissions and |
|
||||
* limitations under the License. |
|
||||
*/ |
|
||||
package org.thingsboard.server.transport.lwm2m.server; |
|
||||
|
|
||||
import lombok.Builder; |
|
||||
import lombok.Data; |
|
||||
|
|
||||
@Data |
|
||||
public class ResultIds { |
|
||||
@Builder.Default |
|
||||
int objectId = -1; |
|
||||
@Builder.Default |
|
||||
int instanceId = -1; |
|
||||
@Builder.Default |
|
||||
int resourceId = -1; |
|
||||
|
|
||||
public ResultIds (String path) { |
|
||||
String[] paths = path.split("/"); |
|
||||
if (paths != null && paths.length > 1) { |
|
||||
this.objectId = (paths.length > 1) ? Integer.parseInt(paths[1]) : this.objectId; |
|
||||
this.instanceId = (paths.length > 2) ? Integer.parseInt(paths[2]) : this.instanceId; |
|
||||
this.resourceId = (paths.length > 3) ? Integer.parseInt(paths[3]) : this.resourceId; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,234 +0,0 @@ |
|||||
/** |
|
||||
* Copyright © 2016-2020 The Thingsboard Authors |
|
||||
* |
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||
* you may not use this file except in compliance with the License. |
|
||||
* You may obtain a copy of the License at |
|
||||
* |
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||
* |
|
||||
* Unless required by applicable law or agreed to in writing, software |
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||
* See the License for the specific language governing permissions and |
|
||||
* limitations under the License. |
|
||||
*/ |
|
||||
package org.thingsboard.server.transport.lwm2m.server.secure; |
|
||||
|
|
||||
import lombok.Data; |
|
||||
import lombok.extern.slf4j.Slf4j; |
|
||||
import org.eclipse.leshan.core.util.Hex; |
|
||||
import org.eclipse.leshan.server.californium.LeshanServerBuilder; |
|
||||
import org.eclipse.leshan.server.redis.RedisRegistrationStore; |
|
||||
import org.eclipse.leshan.server.redis.RedisSecurityStore; |
|
||||
import org.eclipse.leshan.server.security.DefaultAuthorizer; |
|
||||
import org.eclipse.leshan.server.security.EditableSecurityStore; |
|
||||
import org.eclipse.leshan.server.security.SecurityChecker; |
|
||||
import org.thingsboard.server.transport.lwm2m.secure.LwM2MSecurityMode; |
|
||||
import org.thingsboard.server.transport.lwm2m.server.LwM2MTransportContextServer; |
|
||||
import redis.clients.jedis.Jedis; |
|
||||
import redis.clients.jedis.JedisPool; |
|
||||
import redis.clients.jedis.util.Pool; |
|
||||
|
|
||||
import java.math.BigInteger; |
|
||||
import java.net.URI; |
|
||||
import java.net.URISyntaxException; |
|
||||
import java.security.KeyStore; |
|
||||
import java.security.PublicKey; |
|
||||
import java.security.PrivateKey; |
|
||||
import java.security.AlgorithmParameters; |
|
||||
import java.security.KeyFactory; |
|
||||
import java.security.GeneralSecurityException; |
|
||||
import java.security.KeyStoreException; |
|
||||
import java.security.cert.X509Certificate; |
|
||||
import java.security.interfaces.ECPublicKey; |
|
||||
import java.security.spec.*; |
|
||||
import java.util.Arrays; |
|
||||
|
|
||||
import static org.thingsboard.server.transport.lwm2m.secure.LwM2MSecurityMode.*; |
|
||||
|
|
||||
@Slf4j |
|
||||
@Data |
|
||||
public class LwM2MSetSecurityStoreServer { |
|
||||
|
|
||||
private KeyStore keyStore; |
|
||||
private X509Certificate certificate; |
|
||||
private PublicKey publicKey; |
|
||||
private PrivateKey privateKey; |
|
||||
private LwM2MTransportContextServer context; |
|
||||
private LwM2mInMemorySecurityStore lwM2mInMemorySecurityStore; |
|
||||
|
|
||||
private LeshanServerBuilder builder; |
|
||||
EditableSecurityStore securityStore; |
|
||||
|
|
||||
public LwM2MSetSecurityStoreServer(LeshanServerBuilder builder, LwM2MTransportContextServer context, LwM2mInMemorySecurityStore lwM2mInMemorySecurityStore, LwM2MSecurityMode dtlsMode) { |
|
||||
this.builder = builder; |
|
||||
this.context = context; |
|
||||
this.lwM2mInMemorySecurityStore = lwM2mInMemorySecurityStore; |
|
||||
/** Set securityStore with new registrationStore */ |
|
||||
switch (dtlsMode) { |
|
||||
/** Use PSK only */ |
|
||||
case PSK: |
|
||||
generatePSK_RPK(); |
|
||||
if (this.privateKey != null && this.privateKey.getEncoded().length > 0) { |
|
||||
builder.setPrivateKey(this.privateKey); |
|
||||
builder.setPublicKey(null); |
|
||||
getParamsPSK(); |
|
||||
} |
|
||||
break; |
|
||||
/** Use RPK only */ |
|
||||
case RPK: |
|
||||
generatePSK_RPK(); |
|
||||
if (this.publicKey != null && this.publicKey.getEncoded().length > 0 && |
|
||||
this.privateKey != null && this.privateKey.getEncoded().length > 0) { |
|
||||
builder.setPublicKey(this.publicKey); |
|
||||
builder.setPrivateKey(this.privateKey); |
|
||||
getParamsRPK(); |
|
||||
} |
|
||||
break; |
|
||||
/** Use x509 only */ |
|
||||
case X509: |
|
||||
setServerWithX509Cert(); |
|
||||
break; |
|
||||
/** No security */ |
|
||||
case NO_SEC: |
|
||||
builder.setTrustedCertificates(new X509Certificate[0]); |
|
||||
break; |
|
||||
/** Use x509 with EST */ |
|
||||
case X509_EST: |
|
||||
// TODO support sentinel pool and make pool configurable
|
|
||||
break; |
|
||||
case REDIS: |
|
||||
/** |
|
||||
* Set securityStore with new registrationStore (if use redis store) |
|
||||
* Connect to redis |
|
||||
*/ |
|
||||
Pool<Jedis> jedis = null; |
|
||||
try { |
|
||||
jedis = new JedisPool(new URI(this.context.getCtxServer().getRedisUrl())); |
|
||||
securityStore = new RedisSecurityStore(jedis); |
|
||||
builder.setRegistrationStore(new RedisRegistrationStore(jedis)); |
|
||||
} catch (URISyntaxException e) { |
|
||||
e.printStackTrace(); |
|
||||
} |
|
||||
break; |
|
||||
default: |
|
||||
} |
|
||||
|
|
||||
/** Set securityStore with new registrationStore (if not redis)*/ |
|
||||
if (dtlsMode.code < REDIS.code) { |
|
||||
securityStore = lwM2mInMemorySecurityStore; |
|
||||
if (dtlsMode == X509) { |
|
||||
builder.setAuthorizer(new DefaultAuthorizer(securityStore, new SecurityChecker() { |
|
||||
@Override |
|
||||
protected boolean matchX509Identity(String endpoint, String receivedX509CommonName, |
|
||||
String expectedX509CommonName) { |
|
||||
return endpoint.startsWith(expectedX509CommonName); |
|
||||
} |
|
||||
})); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
/** Set securityStore with new registrationStore */ |
|
||||
builder.setSecurityStore(securityStore); |
|
||||
} |
|
||||
|
|
||||
private void generatePSK_RPK() { |
|
||||
try { |
|
||||
/** Get Elliptic Curve Parameter spec for secp256r1 */ |
|
||||
AlgorithmParameters algoParameters = AlgorithmParameters.getInstance("EC"); |
|
||||
algoParameters.init(new ECGenParameterSpec("secp256r1")); |
|
||||
ECParameterSpec parameterSpec = algoParameters.getParameterSpec(ECParameterSpec.class); |
|
||||
if (this.context.getCtxServer().getServerPublicX() != null && !this.context.getCtxServer().getServerPublicX().isEmpty() && this.context.getCtxServer().getServerPublicY() != null && !this.context.getCtxServer().getServerPublicY().isEmpty()) { |
|
||||
/** Get point values */ |
|
||||
byte[] publicX = Hex.decodeHex(this.context.getCtxServer().getServerPublicX().toCharArray()); |
|
||||
byte[] publicY = Hex.decodeHex(this.context.getCtxServer().getServerPublicY().toCharArray()); |
|
||||
/** Create key specs */ |
|
||||
KeySpec publicKeySpec = new ECPublicKeySpec(new ECPoint(new BigInteger(publicX), new BigInteger(publicY)), |
|
||||
parameterSpec); |
|
||||
/** Get keys */ |
|
||||
this.publicKey = KeyFactory.getInstance("EC").generatePublic(publicKeySpec); |
|
||||
} |
|
||||
if (this.context.getCtxServer().getServerPrivateS() != null && !this.context.getCtxServer().getServerPrivateS().isEmpty()) { |
|
||||
/** Get point values */ |
|
||||
byte[] privateS = Hex.decodeHex(this.context.getCtxServer().getServerPrivateS().toCharArray()); |
|
||||
/** Create key specs */ |
|
||||
KeySpec privateKeySpec = new ECPrivateKeySpec(new BigInteger(privateS), parameterSpec); |
|
||||
/** Get keys */ |
|
||||
this.privateKey = KeyFactory.getInstance("EC").generatePrivate(privateKeySpec); |
|
||||
} |
|
||||
} catch (GeneralSecurityException | IllegalArgumentException e) { |
|
||||
log.error("[{}] Failed generate Server PSK/RPK", e.getMessage()); |
|
||||
throw new RuntimeException(e); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void setServerWithX509Cert() { |
|
||||
try { |
|
||||
if (this.context.getCtxServer().getKeyStoreValue() != null) { |
|
||||
setBuilderX509(); |
|
||||
X509Certificate rootCAX509Cert = (X509Certificate) this.context.getCtxServer().getKeyStoreValue().getCertificate(this.context.getCtxServer().getRootAlias()); |
|
||||
if (rootCAX509Cert != null) { |
|
||||
X509Certificate[] trustedCertificates = new X509Certificate[1]; |
|
||||
trustedCertificates[0] = rootCAX509Cert; |
|
||||
builder.setTrustedCertificates(trustedCertificates); |
|
||||
} else { |
|
||||
/** by default trust all */ |
|
||||
builder.setTrustedCertificates(new X509Certificate[0]); |
|
||||
} |
|
||||
} |
|
||||
else { |
|
||||
/** by default trust all */ |
|
||||
this.builder.setTrustedCertificates(new X509Certificate[0]); |
|
||||
log.error("Unable to load X509 files for LWM2MServer"); |
|
||||
} |
|
||||
} catch (KeyStoreException ex) { |
|
||||
log.error("[{}] Unable to load X509 files server", ex.getMessage()); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void setBuilderX509() { |
|
||||
/** |
|
||||
* 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().getServerAlias()); |
|
||||
PrivateKey privateKey = (PrivateKey) this.context.getCtxServer().getKeyStoreValue().getKey(this.context.getCtxServer().getServerAlias(), this.context.getCtxServer().getKeyStorePasswordServer() == null ? null : this.context.getCtxServer().getKeyStorePasswordServer().toCharArray()); |
|
||||
this.builder.setPrivateKey(privateKey); |
|
||||
this.builder.setCertificateChain(new X509Certificate[]{serverCertificate}); |
|
||||
} catch (Exception ex) { |
|
||||
log.error("[{}] Unable to load KeyStore files server", ex.getMessage()); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void getParamsPSK() { |
|
||||
log.info("\nServer uses PSK -> private key : \n security key : [{}] \n serverSecureURI : [{}]", |
|
||||
Hex.encodeHexString(this.privateKey.getEncoded()), |
|
||||
this.context.getCtxServer().getServerSecureHost() + ":" + Integer.toString(this.context.getCtxServer().getServerSecurePort())); |
|
||||
} |
|
||||
|
|
||||
private void getParamsRPK() { |
|
||||
if (this.publicKey instanceof ECPublicKey) { |
|
||||
/** Get x coordinate */ |
|
||||
byte[] x = ((ECPublicKey) this.publicKey).getW().getAffineX().toByteArray(); |
|
||||
if (x[0] == 0) |
|
||||
x = Arrays.copyOfRange(x, 1, x.length); |
|
||||
|
|
||||
/** Get Y coordinate */ |
|
||||
byte[] y = ((ECPublicKey) this.publicKey).getW().getAffineY().toByteArray(); |
|
||||
if (y[0] == 0) |
|
||||
y = Arrays.copyOfRange(y, 1, y.length); |
|
||||
|
|
||||
/** Get Curves params */ |
|
||||
String params = ((ECPublicKey) this.publicKey).getParams().toString(); |
|
||||
log.info( |
|
||||
" \nServer uses RPK : \n Elliptic Curve parameters : [{}] \n Public x coord : [{}] \n Public y coord : [{}] \n Public Key (Hex): [{}] \n Private Key (Hex): [{}]", |
|
||||
params, Hex.encodeHexString(x), Hex.encodeHexString(y), |
|
||||
Hex.encodeHexString(this.publicKey.getEncoded()), |
|
||||
Hex.encodeHexString(this.privateKey.getEncoded())); |
|
||||
} else { |
|
||||
throw new IllegalStateException("Unsupported Public Key Format (only ECPublicKey supported)."); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Binary file not shown.
@ -1,208 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<!-- |
|
||||
|
|
||||
FILE INFORMATION |
|
||||
|
|
||||
OMA Permanent Document |
|
||||
File: OMA-SUP-XML_LWM2M_Connectivity_Monitoring-V1_0_2-20180612-A |
|
||||
Type: xml |
|
||||
Date: 2018-June-12 |
|
||||
|
|
||||
Public Reachable Information |
|
||||
Path: http://www.openmobilealliance.org/tech/profiles |
|
||||
Name: LWM2M_Connectivity_Monitoring-v1_0_2.xml |
|
||||
|
|
||||
NORMATIVE INFORMATION |
|
||||
|
|
||||
Information about this file can be found in the latest revision of |
|
||||
|
|
||||
OMA-TS-LightweightM2M-V1_0_2 |
|
||||
OMA-TS-LightweightM2M_Core-V1_1 |
|
||||
|
|
||||
This is available at http://www.openmobilealliance.org/ |
|
||||
|
|
||||
Send comments to https://github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/issues |
|
||||
|
|
||||
LEGAL DISCLAIMER |
|
||||
|
|
||||
Copyright 2018 Open Mobile Alliance All rights reserved. |
|
||||
|
|
||||
Redistribution and use in source and binary forms, with or without |
|
||||
modification, are permitted provided that the following conditions |
|
||||
are met: |
|
||||
|
|
||||
1. Redistributions of source code must retain the above copyright |
|
||||
notice, this list of conditions and the following disclaimer. |
|
||||
2. Redistributions in binary form must reproduce the above copyright |
|
||||
notice, this list of conditions and the following disclaimer in the |
|
||||
documentation and/or other materials provided with the distribution. |
|
||||
3. Neither the name of the copyright holder nor the names of its |
|
||||
contributors may be used to endorse or promote products derived |
|
||||
from this software without specific prior written permission. |
|
||||
|
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
POSSIBILITY OF SUCH DAMAGE. |
|
||||
|
|
||||
The above license is used as a license under copyright only. Please |
|
||||
reference the OMA IPR Policy for patent licensing terms: |
|
||||
http://www.openmobilealliance.org/ipr.html |
|
||||
--> |
|
||||
<LWM2M xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://openmobilealliance.org/tech/profiles/LWM2M.xsd"> |
|
||||
<Object ObjectType="MODefinition"> |
|
||||
<Name>Connectivity Monitoring</Name> |
|
||||
<Description1> |
|
||||
This LwM2M Object enables monitoring of parameters related to network connectivity. In this general connectivity Object, the Resources are limited to the most general cases common to most network bearers. It is recommended to read the description, which refers to relevant standard development organizations (e.g. 3GPP, IEEE). The goal of the Connectivity Monitoring Object is to carry information reflecting the more up to date values of the current connection for monitoring purposes. Resources such as Link Quality, Radio Signal Strength, Cell ID are retrieved during connected mode at least for cellular networks. |
|
||||
</Description1> |
|
||||
<ObjectID>4</ObjectID> |
|
||||
<ObjectURN>urn:oma:lwm2m:oma:4</ObjectURN> |
|
||||
<LWM2MVersion>1.0</LWM2MVersion> |
|
||||
<ObjectVersion>1.0</ObjectVersion> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Resources> |
|
||||
<Item ID="0"> |
|
||||
<Name>Network Bearer</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Mandatory</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration>0-50</RangeEnumeration> |
|
||||
<Units/> |
|
||||
<Description> |
|
||||
Indicates the network bearer used for the current LwM2M communication session from the network bearer list below. The number range is split into three categories: 0 - 20 are Cellular Bearers 21 - 40 are Wireless Bearers 41 - 50 are Wireline Bearers More specifically: 0: GSM cellular network 1: TD-SCDMA cellular network 2: WCDMA cellular network 3: CDMA2000 cellular network 4: WiMAX cellular network 5: LTE-TDD cellular network 6: LTE-FDD cellular network 7: NB-IoT 8 - 20: Reserved for other types of cellular network 21: WLAN network 22: Bluetooth network 23: IEEE 802.15.4 network 24 - 40: Reserved for other types of local wireless network 41: Ethernet 42: DSL 43: PLC 44 - 50: reserved for other types of wireline networks. |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="1"> |
|
||||
<Name>Available Network Bearer</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Multiple</MultipleInstances> |
|
||||
<Mandatory>Mandatory</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration>0-50</RangeEnumeration> |
|
||||
<Units/> |
|
||||
<Description> |
|
||||
Indicates a list of current available network bearer. Each Resource Instance has a value from the network bearer list. |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="2"> |
|
||||
<Name>Radio Signal Strength</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Mandatory</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration/> |
|
||||
<Units>dBm</Units> |
|
||||
<Description> |
|
||||
Indicates the average value of the received signal strength indication used in the current network bearer (as indicated by Resource 0 of this Object). For the following network bearers the signal strength parameters indicated below are represented by this resource: GSM: RSSI UMTS: RSCP LTE: RSRP NB-IoT: NRSRP For more details on Network Measurement Report, refer to the appropriate Cellular or Wireless Network standards, (e.g. for LTE Cellular Network refer to 3GPP TS 36.133 specification). |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="3"> |
|
||||
<Name>Link Quality</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration/> |
|
||||
<Units/> |
|
||||
<Description> |
|
||||
This contains received link quality e.g. LQI for IEEE 802.15.4 (range 0...255), RxQual Downlink for GSM (range 0...7, refer to [3GPP 44.018] for more details on Network Measurement Report encoding), RSRQ for LTE, (refer to [3GPP 36.214]), NRSRQ for NB-IoT (refer to [3GPP 36.214]). |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="4"> |
|
||||
<Name>IP Addresses</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Multiple</MultipleInstances> |
|
||||
<Mandatory>Mandatory</Mandatory> |
|
||||
<Type>String</Type> |
|
||||
<RangeEnumeration/> |
|
||||
<Units/> |
|
||||
<Description> |
|
||||
The IP addresses assigned to the connectivity interface. (e.g. IPv4, IPv6, etc.) |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="5"> |
|
||||
<Name>Router IP Addresses</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Multiple</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>String</Type> |
|
||||
<RangeEnumeration/> |
|
||||
<Units/> |
|
||||
<Description> |
|
||||
The IP address of the next-hop IP router, on each of the interfaces specified in resource 4 (IP Addresses). Note: This IP Address doesn’t indicate the Server IP address. |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="6"> |
|
||||
<Name>Link Utilization</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration>0-100</RangeEnumeration> |
|
||||
<Units>%</Units> |
|
||||
<Description> |
|
||||
The percentage indicating the average utilization of the link to the next-hop IP router. |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="7"> |
|
||||
<Name>APN</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Multiple</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>String</Type> |
|
||||
<RangeEnumeration/> |
|
||||
<Units/> |
|
||||
<Description> |
|
||||
Access Point Name in case Network Bearer Resource is a Cellular Network. |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="8"> |
|
||||
<Name>Cell ID</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration/> |
|
||||
<Units/> |
|
||||
<Description> |
|
||||
Serving Cell ID in case Network Bearer Resource is a Cellular Network. As specified in TS [3GPP 23.003] and in [3GPP. 24.008]. Range (0...65535) in GSM/EDGE UTRAN Cell ID has a length of 28 bits. Cell Identity in WCDMA/TD-SCDMA. Range: (0...268435455). LTE Cell ID has a length of 28 bits. Parameter definitions in [3GPP 25.331]. |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="9"> |
|
||||
<Name>SMNC</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration>0-999</RangeEnumeration> |
|
||||
<Units>%</Units> |
|
||||
<Description> |
|
||||
Serving Mobile Network Code. This is applicable when the Network Bearer Resource value is referring to a cellular network. As specified in TS [3GPP 23.003]. |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="10"> |
|
||||
<Name>SMCC</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration>0-999</RangeEnumeration> |
|
||||
<Units/> |
|
||||
<Description> |
|
||||
Serving Mobile Country Code. This is applicable when the Network Bearer Resource value is referring to a cellular network. As specified in TS [3GPP 23.003]. |
|
||||
</Description> |
|
||||
</Item> |
|
||||
</Resources> |
|
||||
<Description2/> |
|
||||
</Object> |
|
||||
</LWM2M> |
|
||||
@ -1,147 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<!-- |
|
||||
FILE INFORMATION |
|
||||
|
|
||||
OMA Permanent Document |
|
||||
File: OMA-SUP-LwM2M_BinaryAppDataContainer-V1_0_1-20190221-A |
|
||||
Type: xml |
|
||||
|
|
||||
Public Reachable Information |
|
||||
Path: http://www.openmobilealliance.org/tech/profiles |
|
||||
Name: LwM2M_BinaryAppDataContainer-v1_0_1.xml |
|
||||
|
|
||||
NORMATIVE INFORMATION |
|
||||
|
|
||||
Information about this file can be found in the latest revision of |
|
||||
|
|
||||
OMA-TS-LWM2M_BinaryAppDataContainer-V1_0_1 |
|
||||
|
|
||||
This is available at http://www.openmobilealliance.org/ |
|
||||
|
|
||||
Send comments to https://github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/issues |
|
||||
|
|
||||
CHANGE HISTORY |
|
||||
|
|
||||
15062018 Status changed to Approved by DM, Doc Ref # OMA-DM&SE-2018-0061-INP_LWM2M_APPDATA_V1_0_ERP_for_final_Approval |
|
||||
21022019 Status changed to Approved by IPSO, Doc Ref # OMA-IPSO-2019-0025-INP_LwM2M_Object_App_Data_Container_1_0_1_for_Final_Approval |
|
||||
|
|
||||
LEGAL DISCLAIMER |
|
||||
|
|
||||
Copyright 2019 Open Mobile Alliance. |
|
||||
|
|
||||
Redistribution and use in source and binary forms, with or without |
|
||||
modification, are permitted provided that the following conditions |
|
||||
are met: |
|
||||
|
|
||||
1. Redistributions of source code must retain the above copyright |
|
||||
notice, this list of conditions and the following disclaimer. |
|
||||
2. Redistributions in binary form must reproduce the above copyright |
|
||||
notice, this list of conditions and the following disclaimer in the |
|
||||
documentation and/or other materials provided with the distribution. |
|
||||
3. Neither the name of the copyright holder nor the names of its |
|
||||
contributors may be used to endorse or promote products derived |
|
||||
from this software without specific prior written permission. |
|
||||
|
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
POSSIBILITY OF SUCH DAMAGE. |
|
||||
|
|
||||
The above license is used as a license under copyright only. Please |
|
||||
reference the OMA IPR Policy for patent licensing terms: |
|
||||
https://www.omaspecworks.org/about/intellectual-property-rights/ |
|
||||
|
|
||||
--> |
|
||||
<LWM2M xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://openmobilealliance.org/tech/profiles/LWM2M.xsd"> |
|
||||
<Object ObjectType="MODefinition"> |
|
||||
<Name>BinaryAppDataContainer</Name> |
|
||||
<Description1><![CDATA[This LwM2M Objects provides the application service data related to a LwM2M Server, eg. Water meter data. |
|
||||
There are several methods to create instance to indicate the message direction based on the negotiation between Application and LwM2M. The Client and Server should negotiate the instance(s) used to exchange the data. For example: |
|
||||
- Using a single instance for both directions communication, from Client to Server and from Server to Client. |
|
||||
- Using an instance for communication from Client to Server and another one for communication from Server to Client |
|
||||
- Using several instances |
|
||||
]]></Description1> |
|
||||
<ObjectID>19</ObjectID> |
|
||||
<ObjectURN>urn:oma:lwm2m:oma:19</ObjectURN> |
|
||||
<LWM2MVersion>1.0</LWM2MVersion> |
|
||||
<ObjectVersion>1.0</ObjectVersion> |
|
||||
<MultipleInstances>Multiple</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Resources> |
|
||||
<Item ID="0"><Name>Data</Name> |
|
||||
<Operations>RW</Operations> |
|
||||
<!-- <MultipleInstances>Single</MultipleInstances>--> |
|
||||
<!-- <Mandatory>Optional</Mandatory>--> |
|
||||
<!-- <Type>String</Type>--> |
|
||||
<MultipleInstances>Multiple</MultipleInstances> |
|
||||
<Mandatory>Mandatory</Mandatory> |
|
||||
<Type>Opaque</Type> |
|
||||
<RangeEnumeration /> |
|
||||
<Units /> |
|
||||
<Description><![CDATA[Indicates the application data content.]]></Description> |
|
||||
</Item> |
|
||||
<Item ID="1"><Name>Data Priority</Name> |
|
||||
<Operations>RW</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration>1 bytes</RangeEnumeration> |
|
||||
<Units /> |
|
||||
<Description><![CDATA[Indicates the Application data priority: |
|
||||
0:Immediate |
|
||||
1:BestEffort |
|
||||
2:Latest |
|
||||
3-100: Reserved for future use. |
|
||||
101-254: Proprietary mode.]]></Description> |
|
||||
</Item> |
|
||||
<Item ID="2"><Name>Data Creation Time</Name> |
|
||||
<Operations>RW</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>Time</Type> |
|
||||
<RangeEnumeration /> |
|
||||
<Units /> |
|
||||
<Description><![CDATA[Indicates the Data instance creation timestamp.]]></Description> |
|
||||
</Item> |
|
||||
<Item ID="3"><Name>Data Description</Name> |
|
||||
<Operations>RW</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>String</Type> |
|
||||
<RangeEnumeration>32 bytes</RangeEnumeration> |
|
||||
<Units /> |
|
||||
<Description><![CDATA[Indicates the data description. |
|
||||
e.g. "meter reading".]]></Description> |
|
||||
</Item> |
|
||||
<Item ID="4"><Name>Data Format</Name> |
|
||||
<Operations>RW</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>String</Type> |
|
||||
<RangeEnumeration>32 bytes</RangeEnumeration> |
|
||||
<Units /> |
|
||||
<Description><![CDATA[Indicates the format of the Application Data. |
|
||||
e.g. YG-Meter-Water-Reading |
|
||||
UTF8-string |
|
||||
]]></Description> |
|
||||
</Item> |
|
||||
<Item ID="5"><Name>App ID</Name> |
|
||||
<Operations>RW</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration>2 bytes</RangeEnumeration> |
|
||||
<Units /> |
|
||||
<Description><![CDATA[Indicates the destination Application ID.]]></Description> |
|
||||
</Item></Resources> |
|
||||
<Description2><![CDATA[]]></Description2> |
|
||||
</Object> |
|
||||
</LWM2M> |
|
||||
Binary file not shown.
@ -0,0 +1,403 @@ |
|||||
|
#!/bin/bash |
||||
|
# |
||||
|
# Copyright © 2016-2020 The Thingsboard Authors |
||||
|
# |
||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
|
# you may not use this file except in compliance with the License. |
||||
|
# You may obtain a copy of the License at |
||||
|
# |
||||
|
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
|
# |
||||
|
# Unless required by applicable law or agreed to in writing, software |
||||
|
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
|
# See the License for the specific language governing permissions and |
||||
|
# limitations under the License. |
||||
|
# |
||||
|
|
||||
|
#p) CLIENT_CN=LwX50900000000 |
||||
|
#s) client_start=0 |
||||
|
#f) client_finish=1 |
||||
|
#a) CLIENT_ALIAS=client_alias_00000000 |
||||
|
#b) BOOTSTRAP_ALIAS=bootstrap |
||||
|
#d) SERVER_ALIAS=server |
||||
|
#j) SERVER_STORE=serverKeyStore.jks |
||||
|
#k) CLIENT_STORE=clientKeyStore.jks |
||||
|
#c) CLIENT_STORE_PWD=client_ks_password |
||||
|
#w) SERVER_STORE_PWD=server_ks_password |
||||
|
|
||||
|
#while test $# -gt 0; do |
||||
|
# case "$1" in |
||||
|
# -h|--help) |
||||
|
# echo "$package - attempt to capture frames" |
||||
|
# echo " " |
||||
|
# echo "$package [options] application [arguments]" |
||||
|
# echo " " |
||||
|
# echo "options:" |
||||
|
# echo "-h, --help show brief help" |
||||
|
# echo "-a, --action=ACTION specify an action to use" |
||||
|
# echo "-o, --output-dir=DIR specify a directory to store output in" |
||||
|
# exit 0 |
||||
|
# ;; |
||||
|
# -a) |
||||
|
# shift |
||||
|
# if test $# -gt 0; then |
||||
|
# export PROCESS=$1 |
||||
|
# else |
||||
|
# echo "no process specified" |
||||
|
# exit 1 |
||||
|
# fi |
||||
|
# shift |
||||
|
# ;; |
||||
|
# --action*) |
||||
|
# export PROCESS=`echo $1 | sed -e 's/^[^=]*=//g'` |
||||
|
# shift |
||||
|
# ;; |
||||
|
# -o) |
||||
|
# shift |
||||
|
# if test $# -gt 0; then |
||||
|
# export OUTPUT=$1 |
||||
|
# else |
||||
|
# echo "no output dir specified" |
||||
|
# exit 1 |
||||
|
# fi |
||||
|
# shift |
||||
|
# ;; |
||||
|
# --output-dir*) |
||||
|
# export OUTPUT=`echo $1 | sed -e 's/^[^=]*=//g'` |
||||
|
# shift |
||||
|
# ;; |
||||
|
# *) |
||||
|
# break |
||||
|
# ;; |
||||
|
# esac |
||||
|
#done |
||||
|
|
||||
|
|
||||
|
while getopts p:s:f:a:b:d:j:k:c:w: flag; do |
||||
|
case "${flag}" in |
||||
|
p) client_prefix=${OPTARG} ;; |
||||
|
s) client_start=${OPTARG} ;; |
||||
|
f) client_finish=${OPTARG} ;; |
||||
|
a) client_alias=${OPTARG} ;; |
||||
|
b) bootstrap_alias=${OPTARG} ;; |
||||
|
d) server_alias=${OPTARG} ;; |
||||
|
j) key_store_server_file=${OPTARG} ;; |
||||
|
k) key_store_client_file=${OPTARG} ;; |
||||
|
c) client_key_store_pwd=${OPTARG} ;; |
||||
|
w) server_key_store_pwd=${OPTARG} ;; |
||||
|
esac |
||||
|
done |
||||
|
|
||||
|
# cd to dir of script |
||||
|
script_dir=$(dirname $0) |
||||
|
echo "script_dir: $script_dir" |
||||
|
cd $script_dir |
||||
|
# source the properties: |
||||
|
. ./lwM2M_keygen.properties |
||||
|
|
||||
|
|
||||
|
if [ -n "$client_prefix" ]; then |
||||
|
CLIENT_PREFIX=$client_prefix |
||||
|
fi |
||||
|
|
||||
|
if [ -z "$client_start" ]; then |
||||
|
client_start=0 |
||||
|
fi |
||||
|
|
||||
|
if [ -z "$client_finish" ]; then |
||||
|
client_finish=1 |
||||
|
fi |
||||
|
|
||||
|
if [ -n "$client_alias" ]; then |
||||
|
CLIENT_ALIAS=$client_alias |
||||
|
fi |
||||
|
|
||||
|
if [ -n "$bootstrap_alias" ]; then |
||||
|
BOOTSTRAP_ALIAS=$bootstrap_alias |
||||
|
fi |
||||
|
|
||||
|
if [ -n "$server_alias" ]; then |
||||
|
SERVER_ALIAS=$server_alias |
||||
|
fi |
||||
|
|
||||
|
if [ -n "$key_store_server_file" ]; then |
||||
|
SERVER_STORE=$key_store_server_file |
||||
|
fi |
||||
|
|
||||
|
if [ -n "$key_store_client_file" ]; then |
||||
|
CLIENT_STORE=$key_store_client_file |
||||
|
fi |
||||
|
|
||||
|
if [ -n "$client_key_store_pwd" ]; then |
||||
|
CLIENT_STORE_PWD=$client_key_store_pwd |
||||
|
fi |
||||
|
|
||||
|
if [ -n "$server_key_store_pwd" ]; then |
||||
|
SERVER_STORE_PWD=$server_key_store_pwd |
||||
|
fi |
||||
|
|
||||
|
echo "==Start==" |
||||
|
echo "CLIENT_PREFIX: $CLIENT_PREFIX" |
||||
|
echo "client_start: $client_start" |
||||
|
echo "client_finish: $client_finish" |
||||
|
echo "CLIENT_ALIAS: $CLIENT_ALIAS" |
||||
|
echo "BOOTSTRAP_ALIAS: $BOOTSTRAP_ALIAS" |
||||
|
echo "SERVER_ALIAS: $SERVER_ALIAS" |
||||
|
echo "SERVER_STORE: $SERVER_STORE" |
||||
|
echo "CLIENT_STORE: $CLIENT_STORE" |
||||
|
echo "CLIENT_STORE_PWD: $CLIENT_STORE_PWD" |
||||
|
echo "SERVER_STORE_PWD: $SERVER_STORE_PWD" |
||||
|
|
||||
|
end_point() { |
||||
|
echo "$CLIENT_PREFIX$(printf "%08d" $CLIENT_NUMBER)" |
||||
|
} |
||||
|
client_alias_point() { |
||||
|
echo "$CLIENT_ALIAS$(printf "%08d" $CLIENT_NUMBER)" |
||||
|
} |
||||
|
|
||||
|
# Generation of the keystore. |
||||
|
echo "${H0}====START========${RESET}" |
||||
|
echo "${H1}Server Keystore : ${RESET}" |
||||
|
echo "${H1}==================${RESET}" |
||||
|
echo "${H2}Creating the trusted root CA key and certificate...${RESET}" |
||||
|
# -keysize |
||||
|
# 1024 (when using -genkeypair) |
||||
|
keytool \ |
||||
|
-genkeypair \ |
||||
|
-alias $ROOT_KEY_ALIAS \ |
||||
|
-keyalg EC \ |
||||
|
-dname "CN=$ROOT_CN, OU=$ORGANIZATIONAL_UNIT, O=$ORGANIZATION, L=$CITY, ST=$STATE_OR_PROVINCE, C=$TWO_LETTER_COUNTRY_CODE" \ |
||||
|
-validity $VALIDITY \ |
||||
|
-storetype $STORETYPE \ |
||||
|
-keypass $SERVER_STORE_PWD \ |
||||
|
-keystore $SERVER_STORE \ |
||||
|
-storepass $SERVER_STORE_PWD |
||||
|
|
||||
|
echo |
||||
|
echo "${H2}Creating server key and self-signed certificate ...${RESET}" |
||||
|
keytool \ |
||||
|
-genkeypair \ |
||||
|
-alias $SERVER_ALIAS \ |
||||
|
-keyalg EC \ |
||||
|
-dname "CN=$SERVER_SELF_CN, OU=$ORGANIZATIONAL_UNIT, O=$ORGANIZATION, L=$CITY, ST=$STATE_OR_PROVINCE, C=$TWO_LETTER_COUNTRY_CODE" \ |
||||
|
-validity $VALIDITY \ |
||||
|
-storetype $STORETYPE \ |
||||
|
-keypass $SERVER_STORE_PWD \ |
||||
|
-keystore $SERVER_STORE \ |
||||
|
-storepass $SERVER_STORE_PWD |
||||
|
keytool \ |
||||
|
-exportcert \ |
||||
|
-alias $SERVER_ALIAS \ |
||||
|
-keystore $SERVER_STORE \ |
||||
|
-storepass $SERVER_STORE_PWD | |
||||
|
keytool \ |
||||
|
-importcert \ |
||||
|
-alias $SERVER_SELF_ALIAS \ |
||||
|
-keystore $SERVER_STORE \ |
||||
|
-storepass $SERVER_STORE_PWD \ |
||||
|
-noprompt |
||||
|
|
||||
|
echo |
||||
|
echo "${H2}Creating server certificate signed by root CA...${RESET}" |
||||
|
keytool \ |
||||
|
-certreq \ |
||||
|
-alias $SERVER_ALIAS \ |
||||
|
-dname "CN=$SERVER_CN, OU=$ORGANIZATIONAL_UNIT, O=$ORGANIZATION, L=$CITY, ST=$STATE_OR_PROVINCE, C=$TWO_LETTER_COUNTRY_CODE" \ |
||||
|
-keystore $SERVER_STORE \ |
||||
|
-storepass $SERVER_STORE_PWD | |
||||
|
keytool \ |
||||
|
-gencert \ |
||||
|
-alias $ROOT_KEY_ALIAS \ |
||||
|
-keystore $SERVER_STORE \ |
||||
|
-storepass $SERVER_STORE_PWD \ |
||||
|
-storetype $STORETYPE \ |
||||
|
-validity $VALIDITY | |
||||
|
keytool \ |
||||
|
-importcert \ |
||||
|
-alias $SERVER_ALIAS \ |
||||
|
-keystore $SERVER_STORE \ |
||||
|
-storepass $SERVER_STORE_PWD |
||||
|
|
||||
|
echo |
||||
|
echo "${H2}Creating bootstrap key and self-signed certificate ...${RESET}" |
||||
|
keytool \ |
||||
|
-genkeypair \ |
||||
|
-alias $BOOTSTRAP_ALIAS \ |
||||
|
-keyalg EC \ |
||||
|
-dname "CN=$BOOTSTRAP_SELF_CN, OU=$ORGANIZATIONAL_UNIT, O=$ORGANIZATION, L=$CITY, ST=$STATE_OR_PROVINCE, C=$TWO_LETTER_COUNTRY_CODE" \ |
||||
|
-validity $VALIDITY \ |
||||
|
-storetype $STORETYPE \ |
||||
|
-keypass $SERVER_STORE_PWD \ |
||||
|
-keystore $SERVER_STORE \ |
||||
|
-storepass $SERVER_STORE_PWD |
||||
|
keytool \ |
||||
|
-exportcert \ |
||||
|
-alias $BOOTSTRAP_ALIAS \ |
||||
|
-keystore $SERVER_STORE \ |
||||
|
-storepass $SERVER_STORE_PWD | |
||||
|
keytool \ |
||||
|
-importcert \ |
||||
|
-alias $BOOTSTRAP_SELF_ALIAS \ |
||||
|
-keystore $SERVER_STORE \ |
||||
|
-storepass $SERVER_STORE_PWD \ |
||||
|
-noprompt |
||||
|
|
||||
|
echo |
||||
|
echo "${H2}Creating bootstrap certificate signed by root CA...${RESET}" |
||||
|
keytool \ |
||||
|
-certreq \ |
||||
|
-alias $BOOTSTRAP_ALIAS \ |
||||
|
-dname "CN=$BOOTSTRAP_CN, OU=$ORGANIZATIONAL_UNIT, O=$ORGANIZATION, L=$CITY, ST=$STATE_OR_PROVINCE, C=$TWO_LETTER_COUNTRY_CODE" \ |
||||
|
-keystore $SERVER_STORE \ |
||||
|
-storepass $SERVER_STORE_PWD | |
||||
|
keytool \ |
||||
|
-gencert \ |
||||
|
-alias $ROOT_KEY_ALIAS \ |
||||
|
-keystore $SERVER_STORE \ |
||||
|
-storepass $SERVER_STORE_PWD \ |
||||
|
-storetype $STORETYPE \ |
||||
|
-validity $VALIDITY | |
||||
|
keytool \ |
||||
|
-importcert \ |
||||
|
-alias $BOOTSTRAP_ALIAS \ |
||||
|
-keystore $SERVER_STORE \ |
||||
|
-storepass $SERVER_STORE_PWD |
||||
|
|
||||
|
echo |
||||
|
echo "${H1}Client Keystore : ${RESET}" |
||||
|
echo "${H1}==================${RESET}" |
||||
|
#echo "${H2}Creating client key and self-signed certificate with expected CN...${RESET}" |
||||
|
#keytool \ |
||||
|
# -genkeypair \ |
||||
|
# -alias $CLIENT_ALIAS \ |
||||
|
# -keyalg EC \ |
||||
|
# -dname "CN=$CLIENT_SELF_CN, OU=$ORGANIZATIONAL_UNIT, O=$ORGANIZATION, L=$CITY, ST=$STATE_OR_PROVINCE, C=$TWO_LETTER_COUNTRY_CODE" \ |
||||
|
# -validity $VALIDITY \ |
||||
|
# -storetype $STORETYPE \ |
||||
|
# -keypass $CLIENT_STORE_PWD \ |
||||
|
# -keystore $CLIENT_STORE \ |
||||
|
# -storepass $CLIENT_STORE_PWD |
||||
|
#keytool \ |
||||
|
# -exportcert \ |
||||
|
# -alias $CLIENT_ALIAS \ |
||||
|
# -keystore $CLIENT_STORE \ |
||||
|
# -storepass $CLIENT_STORE_PWD | \ |
||||
|
# keytool \ |
||||
|
# -importcert \ |
||||
|
# -alias $CLIENT_SELF_ALIAS \ |
||||
|
# -keystore $CLIENT_STORE \ |
||||
|
# -storepass $CLIENT_STORE_PWD \ |
||||
|
# -noprompt |
||||
|
|
||||
|
echo |
||||
|
echo "${H2}Import root certificate just to be able to import need by root CA with expected CN...${RESET}" |
||||
|
keytool \ |
||||
|
-exportcert \ |
||||
|
-alias $ROOT_KEY_ALIAS \ |
||||
|
-keystore $SERVER_STORE \ |
||||
|
-storepass $SERVER_STORE_PWD | |
||||
|
keytool \ |
||||
|
-importcert \ |
||||
|
-alias $ROOT_KEY_ALIAS \ |
||||
|
-keystore $CLIENT_STORE \ |
||||
|
-storepass $CLIENT_STORE_PWD \ |
||||
|
-noprompt |
||||
|
|
||||
|
#echo |
||||
|
#echo "${H2}Creating client certificate signed by root CA with expected CN...${RESET}" |
||||
|
#keytool \ |
||||
|
# -certreq \ |
||||
|
# -alias $CLIENT_ALIAS \ |
||||
|
# -dname "CN=$CLIENT_CN, OU=$ORGANIZATIONAL_UNIT, O=$ORGANIZATION, L=$CITY, ST=$STATE_OR_PROVINCE, C=$TWO_LETTER_COUNTRY_CODE" \ |
||||
|
# -keystore $CLIENT_STORE \ |
||||
|
# -storepass $CLIENT_STORE_PWD | \ |
||||
|
# keytool \ |
||||
|
# -gencert \ |
||||
|
# -alias $ROOT_KEY_ALIAS \ |
||||
|
# -keystore $SERVER_STORE \ |
||||
|
# -storepass $SERVER_STORE_PWD \ |
||||
|
# -storetype $STORETYPE \ |
||||
|
# -validity $VALIDITY | \ |
||||
|
# keytool \ |
||||
|
# -importcert \ |
||||
|
# -alias $CLIENT_ALIAS \ |
||||
|
# -keystore $CLIENT_STORE \ |
||||
|
# -storepass $CLIENT_STORE_PWD \ |
||||
|
# -noprompt |
||||
|
|
||||
|
cert_end_point() { |
||||
|
echo "${H2}Creating client key and self-signed certificate with expected CN $CLIENT_SELF_CN ${RESET}" |
||||
|
keytool \ |
||||
|
-genkeypair \ |
||||
|
-alias $CLIENT_CN_ALIAS \ |
||||
|
-keyalg EC \ |
||||
|
-dname "CN=$CLIENT_SELF_CN, OU=$ORGANIZATIONAL_UNIT, O=$ORGANIZATION, L=$CITY, ST=$STATE_OR_PROVINCE, C=$TWO_LETTER_COUNTRY_CODE" \ |
||||
|
-validity $VALIDITY \ |
||||
|
-storetype $STORETYPE \ |
||||
|
-keypass $CLIENT_STORE_PWD \ |
||||
|
-keystore $CLIENT_STORE \ |
||||
|
-storepass $CLIENT_STORE_PWD |
||||
|
keytool \ |
||||
|
-exportcert \ |
||||
|
-alias $CLIENT_CN_ALIAS \ |
||||
|
-keystore $CLIENT_STORE \ |
||||
|
-storepass $CLIENT_STORE_PWD | |
||||
|
keytool \ |
||||
|
-importcert \ |
||||
|
-alias $CLIENT_SELF_ALIAS \ |
||||
|
-keystore $CLIENT_STORE \ |
||||
|
-storepass $CLIENT_STORE_PWD \ |
||||
|
-noprompt |
||||
|
|
||||
|
echo |
||||
|
echo "${H2}Creating client certificate signed by root CA with expected $CLIENT_CN_NAME ${RESET}" |
||||
|
keytool \ |
||||
|
-certreq \ |
||||
|
-alias $CLIENT_CN_ALIAS \ |
||||
|
-dname "CN=$CLIENT_CN_NAME, OU=$ORGANIZATIONAL_UNIT, O=$ORGANIZATION, L=$CITY, ST=$STATE_OR_PROVINCE, C=$TWO_LETTER_COUNTRY_CODE" \ |
||||
|
-keystore $CLIENT_STORE \ |
||||
|
-storepass $CLIENT_STORE_PWD | |
||||
|
keytool \ |
||||
|
-gencert \ |
||||
|
-alias $ROOT_KEY_ALIAS \ |
||||
|
-keystore $SERVER_STORE \ |
||||
|
-storepass $SERVER_STORE_PWD \ |
||||
|
-storetype $STORETYPE \ |
||||
|
-validity $VALIDITY | |
||||
|
keytool \ |
||||
|
-importcert \ |
||||
|
-alias $CLIENT_CN_ALIAS \ |
||||
|
-keystore $CLIENT_STORE \ |
||||
|
-storepass $CLIENT_STORE_PWD \ |
||||
|
-noprompt |
||||
|
} |
||||
|
|
||||
|
while [ "$CLIENT_NUMBER" != "$client_finish" ]; do |
||||
|
CLIENT_CN_NAME=$(end_point) |
||||
|
CLIENT_CN_ALIAS=$(client_alias_point) |
||||
|
echo "$CLIENT_CN_NAME" |
||||
|
echo "$CLIENT_CN_ALIAS" |
||||
|
cert_end_point |
||||
|
CLIENT_NUMBER=$(($CLIENT_NUMBER + 1)) |
||||
|
echo "number $CLIENT_NUMBER" |
||||
|
echo "finish $client_finish" |
||||
|
done |
||||
|
|
||||
|
echo |
||||
|
echo "${H0}!!! Warning ${H2}Migrate ${H1}${SERVER_STORE} ${H2}to ${H1}PKCS12 ${H2}which is an industry standard format..${RESET}" |
||||
|
keytool \ |
||||
|
-importkeystore \ |
||||
|
-srckeystore $SERVER_STORE \ |
||||
|
-destkeystore $SERVER_STORE \ |
||||
|
-deststoretype pkcs12 \ |
||||
|
-srcstorepass $SERVER_STORE_PWD |
||||
|
|
||||
|
echo |
||||
|
echo "${H0}!!! Warning ${H2}Migrate ${H1}${CLIENT_STORE} ${H2}to ${H1}PKCS12 ${H2}which is an industry standard format..${RESET}" |
||||
|
keytool \ |
||||
|
-importkeystore \ |
||||
|
-srckeystore $CLIENT_STORE \ |
||||
|
-destkeystore $CLIENT_STORE \ |
||||
|
-deststoretype pkcs12 \ |
||||
|
-srcstorepass $CLIENT_STORE_PWD |
||||
@ -0,0 +1,57 @@ |
|||||
|
# |
||||
|
# Copyright © 2016-2017 The Thingsboard Authors |
||||
|
# |
||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
|
# you may not use this file except in compliance with the License. |
||||
|
# You may obtain a copy of the License at |
||||
|
# |
||||
|
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
|
# |
||||
|
# Unless required by applicable law or agreed to in writing, software |
||||
|
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
|
# See the License for the specific language governing permissions and |
||||
|
# limitations under the License. |
||||
|
# |
||||
|
|
||||
|
# Keystore common parameters |
||||
|
ROOT_KEY_ALIAS=rootCA |
||||
|
DOMAIN_SUFFIX="$(hostname)" |
||||
|
ROOT_CN="$DOMAIN_SUFFIX $ROOT_KEY_ALIAS" |
||||
|
ORGANIZATIONAL_UNIT=Thingsboard |
||||
|
ORGANIZATION=Thingsboard |
||||
|
CITY=SF |
||||
|
STATE_OR_PROVINCE=CA |
||||
|
TWO_LETTER_COUNTRY_CODE=US |
||||
|
VALIDITY=36500 #days |
||||
|
STORETYPE="JKS" |
||||
|
|
||||
|
#Server |
||||
|
SERVER_STORE=serverKeyStore1.jks |
||||
|
SERVER_STORE_PWD=server_ks_password1 |
||||
|
SERVER_ALIAS=server1 |
||||
|
SERVER_CN="$DOMAIN_SUFFIX server LwM2M signed by root CA" |
||||
|
SERVER_SELF_ALIAS=server_self_signed |
||||
|
SERVER_SELF_CN="$DOMAIN_SUFFIX server LwM2M self-signed" |
||||
|
BOOTSTRAP_ALIAS=bootstrap1 |
||||
|
BOOTSTRAP_CN="$DOMAIN_SUFFIX bootstrap server LwM2M signed by root CA" |
||||
|
BOOTSTRAP_SELF_ALIAS=bootstrap_self_signed |
||||
|
BOOTSTRAP_SELF_CN="$DOMAIN_SUFFIX bootstrap server LwM2M self-signed" |
||||
|
|
||||
|
# Client |
||||
|
CLIENT_STORE=clientKeyStore1.jks |
||||
|
CLIENT_STORE_PWD=client_ks_password1 |
||||
|
CLIENT_ALIAS=client_alias_1 |
||||
|
CLIENT_PREFIX=LwX509_ |
||||
|
CLIENT_SELF_ALIAS=client_self_signed |
||||
|
CLIENT_SELF_CN="$DOMAIN_SUFFIX client LwM2M self-signed" |
||||
|
|
||||
|
# Color output stuff |
||||
|
red=`tput setaf 1` |
||||
|
green=`tput setaf 2` |
||||
|
blue=`tput setaf 4` |
||||
|
bold=`tput bold` |
||||
|
H0=${red}${bold} |
||||
|
H1=${green}${bold} |
||||
|
H2=${blue} |
||||
|
RESET=`tput sgr0` |
||||
@ -1,167 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<!-- |
|
||||
|
|
||||
Copyright © 2016-2020 The Thingsboard Authors |
|
||||
|
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||
you may not use this file except in compliance with the License. |
|
||||
You may obtain a copy of the License at |
|
||||
|
|
||||
http://www.apache.org/licenses/LICENSE-2.0 |
|
||||
|
|
||||
Unless required by applicable law or agreed to in writing, software |
|
||||
distributed under the License is distributed on an "AS IS" BASIS, |
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||
See the License for the specific language governing permissions and |
|
||||
limitations under the License. |
|
||||
|
|
||||
--> |
|
||||
<LWM2M xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://openmobilealliance.org/tech/profiles/LWM2M.xsd"> |
|
||||
<Object ObjectType="MODefinition"> |
|
||||
<Name>Connectivity Monitoring</Name> |
|
||||
<Description1> |
|
||||
This LwM2M Object enables monitoring of parameters related to network connectivity. In this general connectivity Object, the Resources are limited to the most general cases common to most network bearers. It is recommended to read the description, which refers to relevant standard development organizations (e.g. 3GPP, IEEE). The goal of the Connectivity Monitoring Object is to carry information reflecting the more up to date values of the current connection for monitoring purposes. Resources such as Link Quality, Radio Signal Strength, Cell ID are retrieved during connected mode at least for cellular networks. |
|
||||
</Description1> |
|
||||
<ObjectID>4</ObjectID> |
|
||||
<ObjectURN>urn:oma:lwm2m:oma:4</ObjectURN> |
|
||||
<LWM2MVersion>1.0</LWM2MVersion> |
|
||||
<ObjectVersion>1.0</ObjectVersion> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Resources> |
|
||||
<Item ID="0"> |
|
||||
<Name>Network Bearer</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Mandatory</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration>0-50</RangeEnumeration> |
|
||||
<Units/> |
|
||||
<Description> |
|
||||
Indicates the network bearer used for the current LwM2M communication session from the network bearer list below. The number range is split into three categories: 0 - 20 are Cellular Bearers 21 - 40 are Wireless Bearers 41 - 50 are Wireline Bearers More specifically: 0: GSM cellular network 1: TD-SCDMA cellular network 2: WCDMA cellular network 3: CDMA2000 cellular network 4: WiMAX cellular network 5: LTE-TDD cellular network 6: LTE-FDD cellular network 7: NB-IoT 8 - 20: Reserved for other types of cellular network 21: WLAN network 22: Bluetooth network 23: IEEE 802.15.4 network 24 - 40: Reserved for other types of local wireless network 41: Ethernet 42: DSL 43: PLC 44 - 50: reserved for other types of wireline networks. |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="1"> |
|
||||
<Name>Available Network Bearer</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Multiple</MultipleInstances> |
|
||||
<Mandatory>Mandatory</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration>0-50</RangeEnumeration> |
|
||||
<Units/> |
|
||||
<Description> |
|
||||
Indicates a list of current available network bearer. Each Resource Instance has a value from the network bearer list. |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="2"> |
|
||||
<Name>Radio Signal Strength</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Mandatory</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration/> |
|
||||
<Units>dBm</Units> |
|
||||
<Description> |
|
||||
Indicates the average value of the received signal strength indication used in the current network bearer (as indicated by Resource 0 of this Object). For the following network bearers the signal strength parameters indicated below are represented by this resource: GSM: RSSI UMTS: RSCP LTE: RSRP NB-IoT: NRSRP For more details on Network Measurement Report, refer to the appropriate Cellular or Wireless Network standards, (e.g. for LTE Cellular Network refer to 3GPP TS 36.133 specification). |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="3"> |
|
||||
<Name>Link Quality</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration/> |
|
||||
<Units/> |
|
||||
<Description> |
|
||||
This contains received link quality e.g. LQI for IEEE 802.15.4 (range 0...255), RxQual Downlink for GSM (range 0...7, refer to [3GPP 44.018] for more details on Network Measurement Report encoding), RSRQ for LTE, (refer to [3GPP 36.214]), NRSRQ for NB-IoT (refer to [3GPP 36.214]). |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="4"> |
|
||||
<Name>IP Addresses</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Multiple</MultipleInstances> |
|
||||
<Mandatory>Mandatory</Mandatory> |
|
||||
<Type>String</Type> |
|
||||
<RangeEnumeration/> |
|
||||
<Units/> |
|
||||
<Description> |
|
||||
The IP addresses assigned to the connectivity interface. (e.g. IPv4, IPv6, etc.) |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="5"> |
|
||||
<Name>Router IP Addresses</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Multiple</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>String</Type> |
|
||||
<RangeEnumeration/> |
|
||||
<Units/> |
|
||||
<Description> |
|
||||
The IP address of the next-hop IP router, on each of the interfaces specified in resource 4 (IP Addresses). Note: This IP Address doesn’t indicate the Server IP address. |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="6"> |
|
||||
<Name>Link Utilization</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration>0-100</RangeEnumeration> |
|
||||
<Units>%</Units> |
|
||||
<Description> |
|
||||
The percentage indicating the average utilization of the link to the next-hop IP router. |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="7"> |
|
||||
<Name>APN</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Multiple</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>String</Type> |
|
||||
<RangeEnumeration/> |
|
||||
<Units/> |
|
||||
<Description> |
|
||||
Access Point Name in case Network Bearer Resource is a Cellular Network. |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="8"> |
|
||||
<Name>Cell ID</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration/> |
|
||||
<Units/> |
|
||||
<Description> |
|
||||
Serving Cell ID in case Network Bearer Resource is a Cellular Network. As specified in TS [3GPP 23.003] and in [3GPP. 24.008]. Range (0...65535) in GSM/EDGE UTRAN Cell ID has a length of 28 bits. Cell Identity in WCDMA/TD-SCDMA. Range: (0...268435455). LTE Cell ID has a length of 28 bits. Parameter definitions in [3GPP 25.331]. |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="9"> |
|
||||
<Name>SMNC</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration>0-999</RangeEnumeration> |
|
||||
<Units>%</Units> |
|
||||
<Description> |
|
||||
Serving Mobile Network Code. This is applicable when the Network Bearer Resource value is referring to a cellular network. As specified in TS [3GPP 23.003]. |
|
||||
</Description> |
|
||||
</Item> |
|
||||
<Item ID="10"> |
|
||||
<Name>SMCC</Name> |
|
||||
<Operations>R</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration>0-999</RangeEnumeration> |
|
||||
<Units/> |
|
||||
<Description> |
|
||||
Serving Mobile Country Code. This is applicable when the Network Bearer Resource value is referring to a cellular network. As specified in TS [3GPP 23.003]. |
|
||||
</Description> |
|
||||
</Item> |
|
||||
</Resources> |
|
||||
<Description2/> |
|
||||
</Object> |
|
||||
</LWM2M> |
|
||||
@ -1,164 +0,0 @@ |
|||||
<!-- |
|
||||
|
|
||||
Copyright © 2016-2020 The Thingsboard Authors |
|
||||
|
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||
you may not use this file except in compliance with the License. |
|
||||
You may obtain a copy of the License at |
|
||||
|
|
||||
http://www.apache.org/licenses/LICENSE-2.0 |
|
||||
|
|
||||
Unless required by applicable law or agreed to in writing, software |
|
||||
distributed under the License is distributed on an "AS IS" BASIS, |
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||
See the License for the specific language governing permissions and |
|
||||
limitations under the License. |
|
||||
|
|
||||
--> |
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<!-- |
|
||||
FILE INFORMATION |
|
||||
|
|
||||
OMA Permanent Document |
|
||||
File: OMA-SUP-LwM2M_BinaryAppDataContainer-V1_0_1-20190221-A |
|
||||
Type: xml |
|
||||
|
|
||||
Public Reachable Information |
|
||||
Path: http://www.openmobilealliance.org/tech/profiles |
|
||||
Name: LwM2M_BinaryAppDataContainer-v1_0_1.xml |
|
||||
|
|
||||
NORMATIVE INFORMATION |
|
||||
|
|
||||
Information about this file can be found in the latest revision of |
|
||||
|
|
||||
OMA-TS-LWM2M_BinaryAppDataContainer-V1_0_1 |
|
||||
|
|
||||
This is available at http://www.openmobilealliance.org/ |
|
||||
|
|
||||
Send comments to https://github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/issues |
|
||||
|
|
||||
CHANGE HISTORY |
|
||||
|
|
||||
15062018 Status changed to Approved by DM, Doc Ref # OMA-DM&SE-2018-0061-INP_LWM2M_APPDATA_V1_0_ERP_for_final_Approval |
|
||||
21022019 Status changed to Approved by IPSO, Doc Ref # OMA-IPSO-2019-0025-INP_LwM2M_Object_App_Data_Container_1_0_1_for_Final_Approval |
|
||||
|
|
||||
LEGAL DISCLAIMER |
|
||||
|
|
||||
Copyright 2019 Open Mobile Alliance. |
|
||||
|
|
||||
Redistribution and use in source and binary forms, with or without |
|
||||
modification, are permitted provided that the following conditions |
|
||||
are met: |
|
||||
|
|
||||
1. Redistributions of source code must retain the above copyright |
|
||||
notice, this list of conditions and the following disclaimer. |
|
||||
2. Redistributions in binary form must reproduce the above copyright |
|
||||
notice, this list of conditions and the following disclaimer in the |
|
||||
documentation and/or other materials provided with the distribution. |
|
||||
3. Neither the name of the copyright holder nor the names of its |
|
||||
contributors may be used to endorse or promote products derived |
|
||||
from this software without specific prior written permission. |
|
||||
|
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
||||
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
||||
POSSIBILITY OF SUCH DAMAGE. |
|
||||
|
|
||||
The above license is used as a license under copyright only. Please |
|
||||
reference the OMA IPR Policy for patent licensing terms: |
|
||||
https://www.omaspecworks.org/about/intellectual-property-rights/ |
|
||||
|
|
||||
--> |
|
||||
<LWM2M xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://openmobilealliance.org/tech/profiles/LWM2M.xsd"> |
|
||||
<Object ObjectType="MODefinition"> |
|
||||
<Name>BinaryAppDataContainer</Name> |
|
||||
<Description1><![CDATA[This LwM2M Objects provides the application service data related to a LwM2M Server, eg. Water meter data. |
|
||||
There are several methods to create instance to indicate the message direction based on the negotiation between Application and LwM2M. The Client and Server should negotiate the instance(s) used to exchange the data. For example: |
|
||||
- Using a single instance for both directions communication, from Client to Server and from Server to Client. |
|
||||
- Using an instance for communication from Client to Server and another one for communication from Server to Client |
|
||||
- Using several instances |
|
||||
]]></Description1> |
|
||||
<ObjectID>19</ObjectID> |
|
||||
<ObjectURN>urn:oma:lwm2m:oma:19</ObjectURN> |
|
||||
<LWM2MVersion>1.0</LWM2MVersion> |
|
||||
<ObjectVersion>1.0</ObjectVersion> |
|
||||
<MultipleInstances>Multiple</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Resources> |
|
||||
<Item ID="0"><Name>Data</Name> |
|
||||
<Operations>RW</Operations> |
|
||||
<!-- <MultipleInstances>Single</MultipleInstances>--> |
|
||||
<!-- <Mandatory>Optional</Mandatory>--> |
|
||||
<!-- <Type>String</Type>--> |
|
||||
<MultipleInstances>Multiple</MultipleInstances> |
|
||||
<Mandatory>Mandatory</Mandatory> |
|
||||
<Type>Opaque</Type> |
|
||||
<RangeEnumeration /> |
|
||||
<Units /> |
|
||||
<Description><![CDATA[Indicates the application data content.]]></Description> |
|
||||
</Item> |
|
||||
<Item ID="1"><Name>Data Priority</Name> |
|
||||
<Operations>RW</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration>1 bytes</RangeEnumeration> |
|
||||
<Units /> |
|
||||
<Description><![CDATA[Indicates the Application data priority: |
|
||||
0:Immediate |
|
||||
1:BestEffort |
|
||||
2:Latest |
|
||||
3-100: Reserved for future use. |
|
||||
101-254: Proprietary mode.]]></Description> |
|
||||
</Item> |
|
||||
<Item ID="2"><Name>Data Creation Time</Name> |
|
||||
<Operations>RW</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>Time</Type> |
|
||||
<RangeEnumeration /> |
|
||||
<Units /> |
|
||||
<Description><![CDATA[Indicates the Data instance creation timestamp.]]></Description> |
|
||||
</Item> |
|
||||
<Item ID="3"><Name>Data Description</Name> |
|
||||
<Operations>RW</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>String</Type> |
|
||||
<RangeEnumeration>32 bytes</RangeEnumeration> |
|
||||
<Units /> |
|
||||
<Description><![CDATA[Indicates the data description. |
|
||||
e.g. "meter reading".]]></Description> |
|
||||
</Item> |
|
||||
<Item ID="4"><Name>Data Format</Name> |
|
||||
<Operations>RW</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>String</Type> |
|
||||
<RangeEnumeration>32 bytes</RangeEnumeration> |
|
||||
<Units /> |
|
||||
<Description><![CDATA[Indicates the format of the Application Data. |
|
||||
e.g. YG-Meter-Water-Reading |
|
||||
UTF8-string |
|
||||
]]></Description> |
|
||||
</Item> |
|
||||
<Item ID="5"><Name>App ID</Name> |
|
||||
<Operations>RW</Operations> |
|
||||
<MultipleInstances>Single</MultipleInstances> |
|
||||
<Mandatory>Optional</Mandatory> |
|
||||
<Type>Integer</Type> |
|
||||
<RangeEnumeration>2 bytes</RangeEnumeration> |
|
||||
<Units /> |
|
||||
<Description><![CDATA[Indicates the destination Application ID.]]></Description> |
|
||||
</Item></Resources> |
|
||||
<Description2><![CDATA[]]></Description2> |
|
||||
</Object> |
|
||||
</LWM2M> |
|
||||
@ -1,22 +0,0 @@ |
|||||
/** |
|
||||
* Copyright © 2016-2020 The Thingsboard Authors |
|
||||
* |
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||
* you may not use this file except in compliance with the License. |
|
||||
* You may obtain a copy of the License at |
|
||||
* |
|
||||
* http://www.apache.org/licenses/LICENSE-2.0 |
|
||||
* |
|
||||
* Unless required by applicable law or agreed to in writing, software |
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||
* See the License for the specific language governing permissions and |
|
||||
* limitations under the License. |
|
||||
*/ |
|
||||
:host ::ng-deep { |
|
||||
mat-form-field.lwm2m-instances-list { |
|
||||
& > .mat-form-field-wrapper > .mat-form-field-underline { |
|
||||
display: none; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue