Skip to content
This repository has been archived by the owner on Jun 29, 2021. It is now read-only.

Commit

Permalink
Merge pull request #10 from openconnectivity/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
javiguerra committed Oct 9, 2019
2 parents 1988bfe + 81660e6 commit ae33c30
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 21 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
```
Expand Down
2 changes: 1 addition & 1 deletion build/debian/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: OTGC
Version: 2.0.8
Version: 2.1.0
Section: custom
Priority: optional
Architecture: amd64
Expand Down
2 changes: 1 addition & 1 deletion build/debian/otgc_native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# Constants
PROJECT_NAME="otgc"
VERSION="2.0.8"
VERSION="2.1.0"

program=$0

Expand Down
2 changes: 1 addition & 1 deletion extlibs/iotivity-lite
Submodule iotivity-lite updated from 513d1c to d301b8
13 changes: 13 additions & 0 deletions extlibs/patchs/fix_oc_api.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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;
}
%}

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,28 +69,36 @@ public Completable execute() {
}
});
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");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public Completable execute() {
.flatMapCompletable(device -> doxsRepository.resetDevice(device.getDeviceId()))
.delay(delay, TimeUnit.SECONDS)
.andThen(provisioningRepository.resetSvrDb())
.andThen(provisioningRepository.doSelfOwnership())
.andThen(settingRepository.set(SettingRepository.MODE_KEY, OtgcMode.OBT));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ private 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";
Expand Down
11 changes: 11 additions & 0 deletions src/main/resources/data/eonti-root-cert.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----BEGIN CERTIFICATE-----
MIIBnTCCAUKgAwIBAgIUfKTxfZOGE/bSAF+l555yrmzbBZYwCgYIKoZIzj0EAwIw
KzEMMAoGA1UEChMDT0NGMRswGQYDVQQDExJURVNUIE9DRiBSb290IENBIDIwIBcN
MTgxMTI5MTY0MTIyWhgPMjA2ODExMjkxNjQxMjJaMCsxDDAKBgNVBAoTA09DRjEb
MBkGA1UEAxMSVEVTVCBPQ0YgUm9vdCBDQSAyMFkwEwYHKoZIzj0CAQYIKoZIzj0D
AQcDQgAED4xusXQP8CojjLCIy3Kc/6oDZUM2CxKiq4RfKi4A2hZ9uOKD1TrirCGh
yVLso63+OQv1Zi6Og9E4SYMDHqvwZKNCMEAwDgYDVR0PAQH/BAQDAgEGMB0GA1Ud
DgQWBBSYuivCP5E741G+c2v1466PlBfNizAPBgNVHRMBAf8EBTADAQH/MAoGCCqG
SM49BAMCA0kAMEYCIQCyF9qhRMdtJhM922E7BrTENwrwrYU9X66zgRtBTuzrVgIh
ANreyj+BcMMLqXLZUSw1Lbb+4fm+/2ETt92RbrZSwXYt
-----END CERTIFICATE-----

0 comments on commit ae33c30

Please sign in to comment.