|
@@ -38,19 +38,6 @@ public class FactoryPresetsHandler implements OCFactoryPresetsHandler {
|
|
|
}
|
|
|
|
|
|
private void setPKISecurityMfgCert(long deviceIndex) {
|
|
|
- // load Root CA
|
|
|
- byte[] rootCa = getFileBytes("pki_certs/rootca1.pem");
|
|
|
- if (rootCa == null) {
|
|
|
- Log.e(TAG, "Failed to read root ca cetificate");
|
|
|
- return;
|
|
|
- }
|
|
|
- // add Root CA
|
|
|
- int rootCaCredId = OCPki.addMfgTrustAnchor(deviceIndex, rootCa);
|
|
|
- Log.d(TAG, "addMfgTrustAnchor() result = " + rootCaCredId);
|
|
|
- if (rootCaCredId < 0) {
|
|
|
- Log.e(TAG, "Error installing root ca certificate");
|
|
|
- return;
|
|
|
- }
|
|
|
|
|
|
// load End Endtity cert
|
|
|
byte[] cert = getFileBytes("pki_certs/ee.pem");
|
|
@@ -88,6 +75,34 @@ public class FactoryPresetsHandler implements OCFactoryPresetsHandler {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ // load Root CA
|
|
|
+ byte[] rootCa = getFileBytes("pki_certs/rootca1.pem");
|
|
|
+ if (rootCa == null) {
|
|
|
+ Log.e(TAG, "Failed to read root ca cetificate");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // add Root CA
|
|
|
+ int rootCaCredId = OCPki.addMfgTrustAnchor(deviceIndex, rootCa);
|
|
|
+ Log.d(TAG, "addMfgTrustAnchor() result = " + rootCaCredId);
|
|
|
+ if (rootCaCredId < 0) {
|
|
|
+ Log.e(TAG, "Error installing root ca certificate");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //load Root CA 3
|
|
|
+ rootCa = getFileBytes("pki_certs/rootca3.pem");
|
|
|
+ if (rootCa == null) {
|
|
|
+ Log.e(TAG, "Failed to read root ca cetificate");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // add Root CA 3
|
|
|
+ rootCaCredId = OCPki.addMfgTrustAnchor(deviceIndex, rootCa);
|
|
|
+ Log.d(TAG, "addMfgTrustAnchor() result = " + rootCaCredId);
|
|
|
+ if (rootCaCredId < 0) {
|
|
|
+ Log.e(TAG, "Error installing root ca certificate");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
OCPki.setSecurityProfile(deviceIndex, OCSpTypesMask.BLACK, OCSpTypesMask.BLACK, eeCredId);
|
|
|
Log.d(TAG, "setSecurityProfile()");
|
|
|
|