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

Merge pull request #13 from openconnectivity/develop

Merge develop into master
parents 2202d108 51ec02fb
......@@ -53,9 +53,10 @@ The steps required to build the binary of the IoTivity-lite Android API is 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-android>/extlibs/patchs/remove_cred_by_credid.patch
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 **android** directory.
```
......
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;
}
%}
......@@ -30,7 +30,7 @@ android {
minSdkVersion 21
targetSdkVersion 28
versionCode 13
versionName "2.0.10"
versionName "2.1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
compileOptions {
......
-----BEGIN CERTIFICATE-----
MIIBnTCCAUKgAwIBAgIUfKTxfZOGE/bSAF+l555yrmzbBZYwCgYIKoZIzj0EAwIw
KzEMMAoGA1UEChMDT0NGMRswGQYDVQQDExJURVNUIE9DRiBSb290IENBIDIwIBcN
MTgxMTI5MTY0MTIyWhgPMjA2ODExMjkxNjQxMjJaMCsxDDAKBgNVBAoTA09DRjEb
MBkGA1UEAxMSVEVTVCBPQ0YgUm9vdCBDQSAyMFkwEwYHKoZIzj0CAQYIKoZIzj0D
AQcDQgAED4xusXQP8CojjLCIy3Kc/6oDZUM2CxKiq4RfKi4A2hZ9uOKD1TrirCGh
yVLso63+OQv1Zi6Og9E4SYMDHqvwZKNCMEAwDgYDVR0PAQH/BAQDAgEGMB0GA1Ud
DgQWBBSYuivCP5E741G+c2v1466PlBfNizAPBgNVHRMBAf8EBTADAQH/MAoGCCqG
SM49BAMCA0kAMEYCIQCyF9qhRMdtJhM922E7BrTENwrwrYU9X66zgRtBTuzrVgIh
ANreyj+BcMMLqXLZUSw1Lbb+4fm+/2ETt92RbrZSwXYt
-----END CERTIFICATE-----
......@@ -76,28 +76,36 @@ public class InitializeIotivityUseCase {
}
});
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");
}
......
......@@ -39,6 +39,7 @@ public class OtgcConstant {
public static final String INTROSPECTION_CBOR_FILE = "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";
......
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