Unverified Commit ae33c306 authored by Javier Guerra's avatar Javier Guerra Committed by GitHub

Merge pull request #10 from openconnectivity/develop

Merge develop into master
parents 1988bfe4 81660e6c
......@@ -51,9 +51,10 @@ The steps required to build the binary of the IoTivity-lite Linux API are shown
```
git checkout swig
```
2. Apply the patch of the OTGC in IoTivity-lite
2. Apply all patchs of the OTGC in IoTivity-lite
```
git apply <otgc-linux>/extlibs/patchs/remove_cred_by_credid.patch
git apply <otgc-linux>/extlibs/patchs/fix_oc_api.patch
```
3. Go to the linux directory.
```
......
Package: OTGC
Version: 2.0.8
Version: 2.1.0
Section: custom
Priority: optional
Architecture: amd64
......
......@@ -11,7 +11,7 @@
# Constants
PROJECT_NAME="otgc"
VERSION="2.0.8"
VERSION="2.1.0"
program=$0
......
iotivity-lite @ d301b81d
Subproject commit 513d1c9a707beaee87e7fe32742d66ab5bd897fc
Subproject commit d301b81dc3ce39f477318be219ede1d9ab835940
diff --git a/swig/swig_interfaces/oc_api.i b/swig/swig_interfaces/oc_api.i
index e600456c..47ff85cb 100644
--- a/swig/swig_interfaces/oc_api.i
+++ b/swig/swig_interfaces/oc_api.i
@@ -1372,7 +1372,7 @@ bool jni_oc_init_post(const char *uri, oc_endpoint_t *endpoint, const char *quer
OC_DBG("JNI - initPost failed releasing jni_sync_lock");
OC_DBG("JNI: - unlock %s\n", __func__);
}
- return returnValue
+ return returnValue;
}
%}
......@@ -6,7 +6,7 @@
<groupId>otgc</groupId>
<artifactId>otgc</artifactId>
<version>2.0.8</version>
<version>2.1.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
......
......@@ -69,28 +69,36 @@ public class InitOicStackUseCase {
}
});
private void factoryResetHandler(long device) throws Exception {
/* my cert */
byte[] eeCertificate = ioRepository.getBytesFromFile(OtgcConstant.KYRIO_EE_CERTIFICATE).blockingGet();
/* private key of my cert */
byte[] eeKey = ioRepository.getBytesFromFile(OtgcConstant.KYRIO_EE_KEY).blockingGet();
/* intermediate cert */
byte[] subcaCertificate = ioRepository.getBytesFromFile(OtgcConstant.KYRIO_SUBCA_CERTIFICATE).blockingGet();
/* root cert */
byte[] rootcaCertificate = ioRepository.getBytesFromFile(OtgcConstant.KYRIO_ROOT_CERTIFICATE).blockingGet();
int credid = OCPki.addMfgCert(device, eeCertificate, eeKey);
/* Kyrio end-entity cert */
byte[] kyrioEeCertificate = ioRepository.getBytesFromFile(OtgcConstant.KYRIO_EE_CERTIFICATE).blockingGet();
/* private key of Kyrio end-entity cert */
byte[] kyrioEeKey = ioRepository.getBytesFromFile(OtgcConstant.KYRIO_EE_KEY).blockingGet();
int credid = OCPki.addMfgCert(device, kyrioEeCertificate, kyrioEeKey);
if (credid == -1) {
throw new Exception("Add identity certificate error");
}
if (OCPki.addMfgIntermediateCert(device, credid, subcaCertificate) == -1) {
/* Kyrio intermediate cert */
byte[] kyrioSubcaCertificate = ioRepository.getBytesFromFile(OtgcConstant.KYRIO_SUBCA_CERTIFICATE).blockingGet();
if (OCPki.addMfgIntermediateCert(device, credid, kyrioSubcaCertificate) == -1) {
throw new Exception("Add intermediate certificate error");
}
if (OCPki.addMfgTrustAnchor(device, rootcaCertificate) == -1) {
/* Kyrio root cert */
byte[] kyrioRootcaCertificate = ioRepository.getBytesFromFile(OtgcConstant.KYRIO_ROOT_CERTIFICATE).blockingGet();
if (OCPki.addMfgTrustAnchor(device, kyrioRootcaCertificate) == -1) {
throw new Exception("Add root certificate error");
}
if (OCPki.addTrustAnchor(device, kyrioRootcaCertificate) == -1) {
throw new Exception("Add root certificate error");
}
/* EonTi root cert */
byte[] eontiRootcaCertificate = ioRepository.getBytesFromFile(OtgcConstant.EONTI_ROOT_CERTIFICATE).blockingGet();
if (OCPki.addMfgTrustAnchor(device, eontiRootcaCertificate) == -1) {
throw new Exception("Add root certificate error");
}
if (OCPki.addTrustAnchor(device, eontiRootcaCertificate) == -1) {
throw new Exception("Add root certificate error");
}
......
......@@ -53,6 +53,7 @@ public class ResetObtModeUseCase {
.flatMapCompletable(device -> doxsRepository.resetDevice(device.getDeviceId()))
.delay(delay, TimeUnit.SECONDS)
.andThen(provisioningRepository.resetSvrDb())
.andThen(provisioningRepository.doSelfOwnership())
.andThen(settingRepository.set(SettingRepository.MODE_KEY, OtgcMode.OBT));
}
}
......@@ -35,10 +35,11 @@ public class OtgcConstant {
// Credential directory
public static final String OTGC_CREDS_DIR = DATA_PATH + "otgc_creds";
// File databases for IoTivity
// File databases for IoTivity
public static final String INTROSPECTION_CBOR_FILE = DATA_PATH + "introspection.dat";
/* Kyrio certificate chain */
public static String EONTI_ROOT_CERTIFICATE = "eonti-root-cert.pem";
public static String KYRIO_ROOT_CERTIFICATE = "kyrio-root-cert.pem";
public static String KYRIO_SUBCA_CERTIFICATE = "kyrio-subca-cert.pem";
public static String KYRIO_EE_CERTIFICATE = "kyrio-ee-cert.pem";
......
-----BEGIN CERTIFICATE-----
MIIBnTCCAUKgAwIBAgIUfKTxfZOGE/bSAF+l555yrmzbBZYwCgYIKoZIzj0EAwIw
KzEMMAoGA1UEChMDT0NGMRswGQYDVQQDExJURVNUIE9DRiBSb290IENBIDIwIBcN
MTgxMTI5MTY0MTIyWhgPMjA2ODExMjkxNjQxMjJaMCsxDDAKBgNVBAoTA09DRjEb
MBkGA1UEAxMSVEVTVCBPQ0YgUm9vdCBDQSAyMFkwEwYHKoZIzj0CAQYIKoZIzj0D
AQcDQgAED4xusXQP8CojjLCIy3Kc/6oDZUM2CxKiq4RfKi4A2hZ9uOKD1TrirCGh
yVLso63+OQv1Zi6Og9E4SYMDHqvwZKNCMEAwDgYDVR0PAQH/BAQDAgEGMB0GA1Ud
DgQWBBSYuivCP5E741G+c2v1466PlBfNizAPBgNVHRMBAf8EBTADAQH/MAoGCCqG
SM49BAMCA0kAMEYCIQCyF9qhRMdtJhM922E7BrTENwrwrYU9X66zgRtBTuzrVgIh
ANreyj+BcMMLqXLZUSw1Lbb+4fm+/2ETt92RbrZSwXYt
-----END CERTIFICATE-----
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment